England were 267 for eight in their second innings at stumps on the fourth day of the first Test, a lead of 389 runs. (Agencies)
The 24-year-old Ballance, entrusted with the key number three position in only his second Test, was 104 not out after going to his century in the last over of the day with a six off spinner Rangana Herath.
"It's a great feeling and I can't really describe my emotions right now," Zimbabwe-born left-hander Balance said.
"I didn't really think about getting a hundred tonight but I went for it," he said.
He added: "We have put ourselves in a good position to win the game. Hopefully a few will keep a bit low and if we can nip one or two out we have a good chance."
Ballance had earlier added 78 for the seventh wicket with debutant Chris Jordan after a top-order collapse.
Sri Lanka now needed to surpass the highest fourth innings total to win a Test at Lord's -- 344 for one, requiring 342, by the West Indies against England in 1984 -- if they were to go 1-0 up in this two-match series.
Angelo Mathews, the Sri Lanka captain, who earlier in the day had made a hundred himself, was left to reflect on what might have been.
"Until Ballance and Jordan got together, we had a chance (of winning). I'm not saying we're out of the game, but we have to bat sensibly," he said.
Things looked very different as England slumped to 121 for six after Shaminda Eranga took three quick wickets and left-armer Herath followed up with a double strike of his own on the way to figures of four for 95 in 23 overs.
It was a collapse witnessed by Kevin Pietersen, watching from a sponsor's box at Lord's, with the South Africa-born batsman, England's all-time leading run-scorer across all formats, ditched after the 5-0 Ashes drubbing in Australia.
Both attacks in this match had been frustrated by a docile Lord's pitch.
Eranga though defied the sluggish surface with a spell of three wickets for three runs in 21 balls.
England captain Alastair Cook was caught behind for 28 while Australia-born Sam Robson (19), one of three England debutants, and Ian Bell (nine) were both bowled cheaply off the inside edge.
Joe Root walked out at 69 for three, having come in at 74 for three before making an made an unbeaten 200 in England's first innings 575 for nine declared.
But this time Root was lbw for 15 to a clever Herath ball that skidded on and hit him on the back leg.
Moeen Ali, another debutant, confidently drove Herath straight back over the bowler's head for four.
But next ball Herath, spinning one out of the rough, clean-bowled Ali after the left-hander went to drive.
Wicketkeeper Matt Prior had made 86 in the first innings of his comeback Test but he'd only managed 16 on Sunday when he guided Nuwan Kulasekara straight to gully.
Sri Lanka reckoned Ballance was caught behind off Eranga for 36 as the Yorkshire batsman went to cut.
However, Paul Reiffel ruled not out. Sri Lanka challenged the former Australia seamer's decision but, with replay technology inconclusive, Ballance survived.
In fact he thrived, with two resounding boundaries, a cover-drive and a pull, in successive Eranga deliveries taking him into the 90s.
He then then cheekily reverse-swept Herath for four to go to 94 before, off the first ball of Sunday's last over, reaching his century in style with a swept six off the spinner.
Ballance's hundred came in 184 balls, including 12 fours, with his second fifty taking just 54 balls.
Sri Lanka resumed Sunday on 415 for seven, having avoided the follow-on thanks mainly to Kumar Sangakkara's 147 on Saturday.
Mathews, 79 not out overnight, went to a well-deserved century when he cover-drove a James Anderson full-toss for four. But one ball after reaching three figures, Mathews was lbw to Liam Plunkett for 102.
Sri Lanka were eventually all out for 453 to give England a first-innings lead of 122.
England were 267 for eight in their second innings at stumps on the fourth day of the first Test, a lead of 389 runs.