The singer was joined by fellow musicians Jennifer Hudson, Stevie Wonder and Bon Jovi at the '30 Days to Victory' concert at the Nokia Theater in Los Angeles.
The show, which was attended by celebrity guests including George Clooney, was arranged to pull in last-minute donations for Obama's re-election campaign, with tickets costing between $44 and $250.
"I sang for President @BarackObama last night because I believe in Equal Rights #ForAll #Vote," Perry tweeted afterwards.
Obama, who was the guest of honour at the sold-out event, later attended a $25,000-per-head dinner at Wolfgang Puck's WP24 restaurant. The two events raised an estimated $5 million for the Obama campaign.
Jay-Z and Beyoncé recently hosted an Obama fundraiser at the rapper's new 40/40 Club, raising $4 million for the campaign.
Watch Katy Perry perform 'Firework' at the Barack Obama fundraiser below: