When you defeat an opponent that is at a higher level then you, you gain star coins. For every 100 coins you obtain, you gain a level. Whenever you gain a level, you are given the opportunity to increase one of your three properties. The game is fairly well balanced so the choice is almost always a difficult one as you could use all three. There is an upper limit on all of these properties. The upper limit is a bit lower than I would have liked, but I am one of those level up my character style of role-playing game player.
Note that opponent level information is not present in the game, so I am making an assumption about the way star coins are rewarded. I am assuming that all opponents are given a level and that experience is simply max(0, opponent_level - player_level). If I was coding this, I would have done this slightly different. I would probably make the coin counter go up to 1000 instead of 100 and have each opponent given an experience value based on the difficulty of that opponent. I would then reward experience using max(1, opponent_xp - player_level). This way, players would always gain at least 1 experience point for suffering through combat.
Party members only get leveled up when you find a special type of block in the world. These blocks will only work once and initially will only advance a character to super level. Once you reach Yoshi's Island, you will be given an object that will allow you to use those upgrade blocks to raise characters to ultra level.