Tom Latham expressed his gratitude to "world-class" New Zealand captain Kane Williamson after the opener made a patient century on day two of the first Test against Sri Lanka at Basin Reserve.

Latham fought it out for a seventh Test hundred - and his first for almost two years - and was unbeaten on 121 when the Black Caps closed on 311-2.

Williamson made a classy 91 from only 93 balls after Jeet Raval was dismissed for 43 and Ross Taylor will resume on 50 not out on day three, with New Zealand leading by 29 runs.

Latham felt indebted to his skipper after they put on 162 for the second wicket to put the hosts in command.

"At the start of my innings, I wasn't playing that quickly, but the way Jeet Raval played and the way Kane came and played - that took the game to the opposition and kept the scoreboard ticking over," said the left-hander.

"It was good for me. I could just keep going. The most important thing we talk about was making those partnerships big ones and I managed to get a good one with Kane.

"Kane came out and hit the ball fantastically well - I guess he's a world-class player and is hitting the ball unbelievably well in all conditions,

"You look at some of the shots he plays - from ball one - those early boundaries set the tempo for his innings and he kept doing that.

"He's a fantastic player and one to get a few more tips off. When guys are going like that it's almost easier to give them the strike and let them do their thing."