Hales lashed six sixes in his unbeaten 116 off 64 balls, the final one vanishing over mid-wicket in the last over to complete England's highest-ever run chase with four balls to spare after being set a huge target of 190 in the Group One Super 10 clash.
"Centuries in this format do not come along very often. A couple of times in the 90s, I'm very pleased to go over the line today," Hales, who shared the record for England's previous highest T20 score of 99 with Luke Wright, said at the presentation ceremony.
England captain Stuart Broad was full of praise for his team mate.
"On the biggest stage in a World Cup, in conditions a little bit foreign to us, it's one of the best knocks I've ever seen," Broad said.
Put into bat at Chittagong's Zahur Ahmed Chowdhury Stadium, Sri Lanka lost opener Kusal Perera in the second over but Mahela Jayawardene (89) and Tillakaratne Dilshan (55) cashed in on some dreadful England fielding to lift their team to 189 for four.
England made a woeful start to their reply, slumping to nought for two after paceman Nuwan Kulasekara removed Michael Lumb and Moeen Ali for ducks in the first over.
But Hales and Eoin Morgan (57) shared a dazzling 152-run stand for the third wicket in 15.2 overs, dragging England back into the match with ferocious hitting and Ravi Bopara joined Hales to see them through to their target.
Earlier, Jayawardene was on nought when he was lucky to be given not out by TV umpire Steve Davis after Lumb seemed to take a good diving catch at cover.
Jade Dernbach spilled a catch offered by Jayawardene on 19 and Tim Bresnan dropped Dilshan as the Sri Lankan pair forged a 145-run partnership for the second wicket.
Bresnan gave Jayawardene another life when he put down a straightforward catch on the boundary in the 15th over and Bopara dropped Thisara Perera in the final over.
Broad was happy to have bounced back from Saturday's defeat by New Zealand in a rain-ruined match but admitted catching had emerged as a major problem area for his team.
"You never look for excuses at the end of the day. We really messed up, dropping five or six catches.
"The ball was not going in the hand very well, it was really slippery, something we are not particularly used to. So it's something that we'll bear in mind for our next game (against South Africa on Saturday).
"We can't afford to drop key players like that. We got away today with an unbelievable knock from one of our guys. We have to raise our standard with catching from the next game."
- Sports & Recreation
- Mahela Jayawardene
- Zahur Ahmed Chowdhury Stadium
- Michael Lumb
- Tillakaratne Dilshan