In both games, her power grants Mario or Luigi the power to Star Spin. She briefly appears above their heads a couple seconds after they perform a Star Spin. This indicates that they can now do another. She also pops out of their hat to perform a little dance whenever they return to the Comet Observatory or the Starship Mario with a Power Star.
Super Mario Galaxy
In Super Mario Galaxy, Luma appears in the form of a Star Bunny. After catching Luma and her two companions, she will reveal Rosalina to Mario. Rosalina then bestows Luma upon Mario, granting Mario the Star Spin ability.
Throughout the entirety of Super Mario Galaxy, Luma assists Mario in her fight against Bowser. Luma stays in Mario's hat the entirety of the game, only popping her head out after the spin ability was performed.
In the ending, all of the Lumas, including Luma traveling with Mario or Luigi, fly towards the black hole, and turn into new galaxies. In the secret ending obtained by collecting 120 Power Stars, she is seen in the Gateway Galaxy near what is presumed to be the spaceship that Rosalina rode with her original apricot colored Luma.