From the Super Mario Wiki
Mario meets him in Ghostly Galaxy, in which he must use Pull Stars to navigate through the track. He also meets him in the Boo's Boneyard Galaxy. Here, Mario must turn into Boo Mario and race through a tunnel. When Mario meets the Spooky Speedster, he calls the Power Star "it", assuming Mario is also after "it". If Mario reaches the finish area first, the Spooky Speedster gives him the Power Star. However, if Spooky Speedster gets to the Power Star first, Mario will lose a life.
Super Mario Galaxy Trading Card Description
Mario encounters this restless spirit deep in the Ghostly Galaxy. Spooky Speedster is a Boo that challenges Mario to a race through the cosmos for a Power Star. Mario must use Pull Stars to navigate the creepy, bone-ridden course. If he beats him, Spooky will graciously award the celestial prize.