The Portugal captain, 28, was named world player of the year for the first time since 2008 by national coaches, captains and journalists.
Germany goalkeeper Nadine Angerer won the women's world player of the year.
Former Bayern Munich coach Jupp Heynckes picked up the coach of the year accolade.
Ronaldo claimed the award with a total of 1,365 points, ahead of Messi (1,205) and Ribery (1,127), with the votes cast by 184 coaches, 184 national captains and 173 members of the global media.
Messi, 26, had won the award for the last four years, but Ronaldo had been viewed as the front-runner this time after scoring 66 goals in 56 games in 2013 for club and country.
They included a sensational hat-trick for Portugal against Sweden in their World Cup qualifying play-off second leg, which sealed a place in the finals in Brazil.
"First of all, I have to say a great thanks to all of my team-mates with the club and the national team," Ronaldo said as he cried during his speech.
"Without all of their efforts, this would not have been possible. I am very happy; it is very difficult to win this award.
"Everybody that has been involved with me on a personal level, I have to thank - my wife, my friends, my son. It is a tremendously emotional moment. All I can say is thank you to everybody that has been involved."
Angerer, 35, saved two penalties in Germany's 1-0 win over Norway in the 2013 European Championship final and was named player of the match.
"I have to say that I'm a little surprised, but very thankful," the Brisbane Roar goalkeeper said. "You never get a success like this on your own. I have to thank my team-mates and my goalkeeping coach who raised me to a level that I never thought I'd get to."
Germany manager Silvia Neid won the women's coach award, while Heynckes, who retired at the end of the last season after guiding Bayern Munich to a historic treble, said: "Maybe 10 years ago, I wouldn't even have dreamt of this. I am humbled and happy to be standing here."