The tourists lost five wickets before lunch as poor shot selection saw them slip to the perilous position of 103-5 after winning the toss in Galle.
But wicketkeeper Foakes' 184-ball knock took England to 321-8 at the close.
Sam Curran scored 48 in a partnership of 88 with 25-year-old Foakes, who also put on 61 with Jos Buttler.
Foakes was one of two England debutants in the team - along with opener Rory Burns, who took Alastair Cook's place at the top of the order - while bowler Stuart Broad was left out.
Burns was out for nine in the third over and when four more wickets fell in the morning session it looked as though England could be bowled out for a small total.
But Foakes, Buttler and Curran showed greater patience than the top order and guided their team to a much-improved position, which gives England a platform in the match on a spinning wicket.
Foakes is England's third wicketkeeper in their last three Tests
Foakes came to the crease for the first time in Test cricket shortly before lunch despite batting at number seven, having seen the top order perform poorly before him.
The wicketkeeper-batsman was only brought into the squad as a late replacement when Jonny Bairstow was injured during the one-day series.
But in comparison to those that came and swiftly went before him, he was mature, calm and accumulated runs carefully early in his innings.
At first batting alongside Buttler, he blocked good deliveries and was content to work the ball into the outfield, so it was not until his 44th ball that he hit his first boundary in Tests.
The Surrey player hit boundaries all around the wicket as he grew into his innings and was especially impressive in the way he rotated the strike by using his feet to nudge the ball into the leg-side off the spinners.
When Buttler edged Perera behind England were 164-6 but once again Curran showed his worth as a batsman at number eight.
As he did in the summer series against India, his defence looked solid and he also hit three big sixes from loose deliveries from the spinners.
Surrey team-mates Foakes and Curran were together for 200 balls for their 88 runs and, in contrast to the poor batting earlier in the day, looked at home in the Test-match environment.
Curran fell to mystery spinner Akila Dananjaya, edging to first slip Dinesh Chandimal when playing expansively, but Adil Rashid then added a 38-ball 35 to help England to a score that arguably means they had the better of the opening day.