Baldelli put the Rays ahead on Wilson Betemit's fielding error and Rafael Soriano made the lead hold up with his 45th save of the season in the bottom of the 12th, handing Tampa Bay a win in its regular season finale.
The team realized it had clinched the AL East crown and home-field advantage throughout the playoffs before the game was over when the New York Yankees were defeated by the Boston Red Sox.
The Rays ended the season with an AL-best record of 96-66 and will begin the post-season by hosting the Texas Rangers Wednesday.
Jeff Niemann (12-8) was credited with the win after tossing a scoreless 11th inning.
Dusty Hughes (1-3) drew the defeat for Kansas City after allowing the late unearned run.
Alex Gordon popped a two-run homer for the Royals, who ended the season with a 67-95 mark.