There are two routes.
Beat the levels and find the secret exits as well. Reaching those hidden paths is what opens up the later content, so exploring each stage properly matters more than simply finishing it.
Collect every Star Coin in a world to unlock one level of World 9. To open all eight, you need every Star Coin across Worlds 1 through 8.
Once World 9's Star Coins are done, you have essentially completed the game — ordinary coins and your score do not factor into it.