The setting was the ornate East Room, chandeliers overhead, George and Martha Washington portraits on the walls and an all-star lineup of performers cranking out some of McCartney's greatest hits.
Stevie Wonder had the Obamas clapping to "We Can Work It Out." The Jonas Brothers did "Baby You Can Drive My Car." Corinne Bailey Rae slowed things down with "Blackbird." And Faith Hill stroked "Long and Winding Road."
It was McCartney himself who brought down the house by belting out "Michelle," aiming his words straight at a first lady named Michelle.
He said he'd been "itching" to perform it at the White House, and asked the president's forgiveness in advance. The first lady was soon mouthing the words along with McCartney and the president was swaying in his seat.
After serenading the first lady with the lyrics "I love you, I love you, I love you," McCartney joked that he just might be the "first guy ever to be punched out by a president."
The whole night was built around Obama's presentation to McCartney of the Gershwin Prize for Popular Song, awarded by the Library of Congress.
McCartney said it was a moment like no other.
"I don't think there could be anything more special than to play here," the Englishman said.
And then he volunteered to make it a regular gig.
"Lunchtimes, we could come around," he offered. "We're cheap."
McCartney, 67, left no question about how he felt about Obama, telling the president that in tough times, "You have billions of us who are rooting for you and we know you are going to come through."
Later, after the TV cameras had left, he expressed appreciation for the Library of Congress and added a zinger: "After the last eight years, it's great to have a president who knows what a library is."
Obama hailed McCartney's songs as a huge part of American culture, telling the singer-songwriter, "That's right, we stole you, Sir Paul."
The Beatles might not have been the first rock group, Obama said, but "they blew the walls down for everyone else."
"They helped to lay the soundtrack for an entire generation," the president said.
McCartney closed out the concert with a string of hits that had the whole audience singing along to "Hey Jude."
By the end, Obama and his family were on stage singing along with the "nah, nah, hey Jude."
Comedian Jerry Seinfeld supplied the concert with its comic relief. He had lots of compliments for McCartney and one complaint - he couldn't quite figure some of McCartney's lyrics.
Such as: "She was just 17. You know what I mean."
Seinfeld: "I'm not sure I do know what you mean, Sir Paul. I think I know what you mean. And I think there's a law enforcement agency in a couple of states that might want to ask you a few questions."
Among others performing were Elvis Costello, Emmylou Harris, Herbie Hancock, White Stripes singer and guitarist Jack White, Lang Lang and Foo Fighters frontman Dave Grohl.
The Gershwin prize is named for the songwriting brothers George and Ira Gershwin, whose collections are housed at the library. Previous recipients of the Gershwin award are Wonder and Paul Simon.
Those not lucky enough to snag tickets to the East Room gig can catch the concert July 28, when it's televised on PBS' "In Performance at the White House."