Cheteshwar Pujara recorded his seventh hundred and held India's innings together against an inspired spell of fast bowling by Dhammika Prasad on the second day of the third and final Test against Sri Lanka.
Pujara, playing his first Test since the Boxing Day match against Australia in December, remained unbeaten on 135 and guided India to 292 for eight wickets before rain brought an early close to the day's play.
Ishant Sharma (two) was not out at the other end.
Resuming on 50-2, the visitors lost captain Virat Kohli (18) early but Pujara and Rohit Sharma (26) added 55 for the fourth wicket to prop up the Indian innings in the deciding match of the series, tied at 1-1.
Rohit, who has recently been preferred to Pujara in the Test team, fell in the last over before the lunch break, edging Prasad to Upul Tharanga at first slip.
After a rain-hit opening day when just 15 overs of play was possible, Sri Lanka came back strongly in the morning session with Prasad troubling the batsmen on numerous occasions.
Pujara, forced to bat at the top due to injuries to regular openers, looked solid in defence but failed to rotate the strike and only found his scoring touch when Mathews introduced off-spinner Tharindu Kaushal into the attack.
The right-handed batsman hit Kaushal for three successive boundaries and the runs started flowing for him after that. The 27-year-old reached triple figures with a tight single off spinner Rangana Herath.
India 292-8 (Pujara 135, Prasad 4-38)