From the Super Mario Wiki
Retrieved from "http://www.mariowiki.com/index.php?title=Portal&oldid=1511080"
A Portal is a powerful cosmic gateway found solely in Super Mario Galaxy 2. Portals are greenish-white in color, round in shape, and allow Starship Mario to transcend the boundaries between all seven worlds found in the game. A Portal is created via the power of a Grand Star. When Mario returns to Starship Mario after having defeated Bowser, Bowser Jr., or one of Bowser Jr.'s henchmen or machines in one of the six boss galaxies in the game, the Grand Star that he returns with will immediately shoot out into space directly in front of Starship Mario, and explode into a Portal. Access to the next sequential world in the game will now be granted.
Originally, the first time a new Portal appears in the game, a short cutscene will play where Lubba talks to Mario before he pilots Starship Mario directly into the Portal, thereby advancing to the next world. After each cutscene, the Portals that are created will remain at the beginning and end of each world (with the obvious exception of World 1 and World S, which only have Portals at the end and the beginning respectively), allowing the player to freely travel between all unlocked worlds whenever they want. Alternatively, the player could also use the Grand World Map, which, though they are not physically shown when in use, also requires the physical presence of a Portal to allow Starship Mario to travel between worlds quickly.