Mendis remained unbeaten on 166 at stumps after sharing a 196-run stand with Asela Gunaratne (85) for the fourth wicket at Galle International Stadium on the opening day of the two-Test series.
Bangladesh pace bowler Subashis Roy thought he had Mendis out for a golden duck when wicketkeeper Liton Das dived to his right to take a catch off an inside edge.
But a TV replay showed the bowler had overstepped, prompting the umpires to declare a no ball and enable the 22-year-old Mendis to go on to compile his second Test century.
Mendis and Gunaratne's massive partnership put the hosts firmly in control of the match by close of play after they were 92-3 at one stage.
Also Read
Gunaratne, who replaced injured regular skipper Angelo Mathews in the starting lineup, hit seven fours in his second half-century in three Tests before he was bowled by Taskin Ahmed.
The pair came together after the injury-plagued fast bowler Mustafizur Rahman, playing his first Test since August 2015, removed Dinesh Chandimal.
Bangladesh started the day in positive fashion after stand-in Sri Lanka skipper Rangana Herath won the toss and asked them to bowl first on a flat pitch.
The visitors struck in the sixth over when Roy beat opener Upul Tharanga with a perfect inswinger to uproot his middle stump before the no-ball denied him Mendis's wicket off the next ball.
Mendis and Karunaratne put on 45 for the second wicket before Bangladesh's 19-year-old spinner Mehedi struck, bowling Karunaratne through the gate.
Liton was keeping wicket for the tourists after captain Mushfiqur Rahim, wanting to concentrate on his batting, handed him the gloves.
The hosts went in with three spinners, meaning all-rounder Dhananjaya de Silva missed out after playing the last Test during Sri Lanka's recent tour of South Africa.
The second Test, which will be Bangladesh's 100th, will be in Colombo from March 15-19.
Disclaimer: No Business Standard Journalist was involved in creation of this content