By lunch Australia were 4-378, a lead of 204 runs with six first innings wickets remaining, with Marsh and Michael Hussey adding 258 for the fourth wicket before Hussey fell for 142 shortly before the break.
Their stand was a record for any partnership by Australia in Sri Lanka, eclipsing the 218 made by Simon Katich and Justin Langer in Colombo in 2004.
Marsh made it to lunch with his wicket intact and will resume in the afternoon session on 130no, chasing Charles Bannerman’s 165no against England in 1877 as the highest score on Test debut by an Australian.
Usman Khawaja was unbeaten on one when lunch was taken.
West Australian Marsh resumed day three on the ominous figure of 87 but guided the first ball of the day past the slips and gully for four and never looked back.
The 28-year-old left-hander became the 19th Australian to make a century on Test debut, and first since fellow West Australian Marcus North in 2009, when he swept a ball to midwicket which ricocheted off the short-leg and he scampered two.
That moment, full of fist-pumping and a standing ovation from a small knot of Australia supporters including Marsh’s former Test-playing father Geoff, came just three balls after Michael Hussey had posted his own hundred – the 36-year-old’s 14th at this level.
Hussey himself has enjoyed a special match, taking the wicket of Kumar Sangakkara – just his third scalp in 61 Tests – as well as a blinding catch on day one before his performance with the bat.
A victory for Australia in this Test would give them an unbeatable 2-0 lead in the three-match series and ensure they would move above Sri Lanka to fourth in the world rankings