Victory took the 32-year-old Portugal international level with 30-year-old Argentine Messi, who won the most recent of his five awards in 2015.
Messi's ex-Barcelona team-mate Neymar, now at Paris St-Germain, was third.
Last season, Ronaldo helped Real Madrid win the Champions League and their first La Liga title since 2012.
Ronaldo added the 2017 Ballon d'Or to those he won in 2008, 2013, 2014 and 2016, and Messi is the only other recipient of the award since 2009.
"This is something I look forward to every year," he said, after receiving the award on the Eiffel Tower in Paris.
"Thanks to my Real Madrid team-mates. And I want to thank the rest of the people who helped me reach this level."
The 2016-17 campaign was a stellar season for the former Manchester United player.
After helping Portugal win Euro 2016, he scored 42 goals for Real in all competitions as they won their 33rd La Liga title and 12th European Cup.
He scored twice in a 4-1 Champions League final win over Juventus and netted 25 times in 29 league games as Los Blancos finished three points ahead of Barcelona.