He brought it up with a classy off drive, his 17th boundary. He raised his arms, waved his bat to the New Zealand dressing room and doubtless felt immense satisfaction at the achievement.
It followed centuries against Bangladesh in Hamilton in 2010 and in Bulawayo against Zimbabwe a year later, which was 40 test innings ago.
Guptill spent two years out of the national side from May 2013, before regaining his place on the back of his fine World Cup tournament this year.
Having fought his way back into the side, he had a tough time of it in Australia recently.
The hundred came off 147 balls with 18 fours and when he was out with five overs left in the day, had faced 234 balls and hit 21 fours.
His main partners were Kane Williamson and captain Brendon McCullum.
Williamson was 12 runs shy of a 13th test hundred, and fifth of the year, when he was caught at first slip off the penultimate ball before tea. The pair added a record 173 for the second wicket against Sri Lanka.
McCullum hurtled along to 75 - out of a partnership of 89 - before sweeping to be caught at deep backward square leg, having faced just 57 deliveries.
The lower middle order sagged, both Mitchell Santner and BJ Watling departing quickly, then Guptill and Tim Southee near the end, as five wickets fell for 65 in 14 overs, to give Sri Lanka some satisfaction on a day in which they were definitely second best.
Suranga Lakmal picked up two wickets, as did Nuwan Pradeep and Dushmantha Chameera, who worked up good speed and had plenty of energy but felt the heat of McCullum's bat.
Allrounder Milinda Siriwardana and captain Angelo Mathews bagged a wicket apiece.
SCOREBOARD
WAGONWHEEL
MANHATTAN