The England all-rounder’s rearguard action with the bat all but saved the final test of the two-match series.
However, the doughty resistance of last man James Anderson was finally ended when he spooned a Shaminda Eranga bouncer to Rangana Herath at square leg for a 55-ball duck that completed Sri Lanka’s 100-run victory at Headingley.
The defeat made for a miserable start for new England coach Peter Moores, installed for a second term following the 5-0 drubbing in Australia at the start of the year.
It also increased the pressure on captain Alastair Cook who has struggled for runs that could have deflected some of the growing criticism he has faced over his leadership.
The defeat, following a dismal fourth day when man-of-the-match Angelo Mathews wrested the initiative away from England with 160 and paceman Dhammika Prasad grabbed four wickets, should not detract from a remarkable innings by Moeen in only his second test.
“I’m obviously very gutted,” he told Sky Sports after England were bowled out for 249. “A hundred to save the game would have been fantastic but it doesn’t mean as much with the guys so disappointed.
“I had to fight myself a bit. I’d much rather get 99 and save the game.”
Defeat for England came on the back of their embarrassing 5-0 Ashes drubbing by Australia at the start of the year.
Sri Lanka, by contrast, were understandably delighted at the way they turned round the short series, having clung on for a nail-biting draw in the opening test.
“We had to really fight at Lord’s and here we had to dig deep,” said experienced batsman Mahela Jayawardene.
“This is something special for us, our first series win in England. We always believed in our ability, we felt we had something special to give … the way the quicks bowled was remarkable.”
Having resumed on Tuesday at 57 for five, chasing an unlikely victory target of 350, England made a solid start in their bid to save the game but lost Joe Root for a 108-ball 31 and Matt Prior (10) in reaching 173 for seven at tea after rain had interrupted play.
Prasad, who ended with figures of five for 50, took his fifth wicket by removing Prior, leaving left-hander Moeen as England’s last hope.
Though Moeen batted all day, partners Chris Jordan (21) and Stuart Broad (duck) were both trapped lbw by Herath (three for 59) before Anderson’s hour-long resistance was ended right at the end.
Earlier, perhaps frustrated by the lack of a breakthrough, Sri Lanka captain Mathews exchanged words with Root and umpire Billy Bowden was forced to intervene.
As the sledging continued Eranga subjected Root to a feisty spell, troubling the 23-year-old with some fiery bouncers.
Root’s defiance was finally ended when he edged Nuwan Pradeep to Lahiru Thirimanne in the gully, ending a 67-run sixth-wicket partnership with Moeen.
The first test ended in a draw after England narrowly failed to take the last Sri Lanka wicket in another thrilling final session.
(Editing by David Goodman)