From the Super Mario Wiki
A Gravity Spotlight is a special light that shines on a wall or floor and has its own pull of Gravity. When Mario (or Luigi) walks into a Gravity Spotlight, he will either be pulled towards it or pushed away from it, allowing him to walk on walls or travel between planets. In Super Mario Galaxy, Gravity Spotlights are found only in the mission The Fate of the Universe in Bowser's Galaxy Reactor. There are a total of eight Gravity Spotlights found here, three of which will pull the player from one planet to another and five of which will allow the player to walk on walls to reach different areas.