New Zealand chase 257 for victory on day five of first test against Sri Lanka
Matthews scored a defiant 115 and shared partnerships of 105 with Dinesh Chandimal (42) and 60 with Dhananjaya de Silva (47 not out) to help extend Sri Lanka's lead from 65 runs overnight to 284 when they were dismissed for 302.
A Daryl Mitchell century and stiff resistance from the tail rescued the first New Zealand innings, but they will need the top order to lay a decent platform if they are to take the lead in the two-match series.
They were 28 for one at stumps with Tom Latham unbeaten on 11 alongside Kane Williamson, who will resume on seven as the Black Caps go for a win that would end Sri Lanka's hopes of playing in the World Test Championship (WTC) final in June.
New Zealand's highest previous successful fourth innings run chase also came in Christchurch in 1994 when they scored 324-5 to beat Pakistan by five wickets at the Lancaster Park ground destroyed in the 2011 earthquake.
See the full scorecard and follow the match on Flashscore.
Opener Devon Conway's departure for five, chipping the ball straight back to Kasun Rajitha, will not help them match that feat, but Latham and Williamson came through a few nervous moments to safely reach the close of play.
Mathews earlier showed admirable control throughout his 235-ball innings, punishing bad balls with 11 boundaries but largely happy to occupy the crease and build partnerships.
Prabath Jayasuriya added only four runs to his overnight tally before departing, caught behind, for six, but Chandimal stuck around until Tim Southee bowled him through the gate with the new ball after lunch.
That was the only wicket to fall in the second session but once Mathews edged a Matt Henry delivery behind, the Sri Lanka tail folded fairly quickly.
Blair Tickner (4-100) had the best figures of a bowling attack missing Neil Wagner, who sustained a back injury bowling on day three and has been sidelined for at least six weeks.
Henry soldiered on despite having three stitches on the webbing between his thumb and index finger on his bowling hand on Saturday. He cleverly used his left hand to tip a Williamson throw onto the stumps and run out Lahiru Kumara.
Seamer Doug Bracewell will join the squad for the second test after recovering from a groin strain.
Sri Lanka will qualify for the WTC final if they can sweep New Zealand in this series and Australia can deny India victory in the fourth test in Ahmedabad.