“You have billions of us who are rooting for you, and we know you’re going to come through,” McCartney told Obama at a White House concert in the British pop star's honor Wednesday evening.
In accepting the Library of Congress’ Gershwin Prize for Popular Song, McCartney said the award was especially significant coming from “this president.”
The show of support came a day after McCartney urged Obama’s critics to “lay off” the president because he was a “great guy.”
“After the last eight years, it’s great to have a president who knows what a library is,” McCartney followed on Tuesday, The Wall Street Journal reported.
The 67-year-old musician kicked off the concert by performing the Beatles hit “Got to Get You Into My Life.”
With first lady Michelle Obama in attendance, McCartney ended the show with an acoustic version of the love ballad “Michelle.”
"There's a song I've been itching to sing at the White House," he said. "I hope the president will forgive me."
In between, an all-star lineup cranked out other McCartney and Beatles 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."
Elvis Costello crooned "Penny Lane," and called it a "thing of wonder and beauty," noting that his mother grew up not far away from the now-famous street in Liverpool, England.
Jerry Seinfeld 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."
"I'm not sure I do know what you mean, Sir Paul," Seinfeld said. "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 other performers: Emmylou Harris, White Stripes singer and guitarist Jack White and Foo Fighters frontman Dave Grohl, who was spotted in D.C. earlier in the week at the famous 9:30 Club's 30th anniversary bash.
Grohl told the crowd he's a D.C. native and has played "every club, every basement, every arena and every stadium." But, he said: "All of that has nothing on Paul: You're definitely my hero. And Mr. President, you're definitely my other hero."
The Gershwin prize is named for the songwriting brothers George and Ira Gershwin, whose collections are housed at the Library of Congress. Previous recipients of the Gershwin award are Wonder and Paul Simon.
McCartney played a private concert at the library on Tuesday, and said he'd grown up listening to music by the Gershwin brothers.
For all the awards the former Beatle has collected over the years, he said performing before the Obamas in the East Room was still a pinch-me moment.
"For an English kid growing up in Liverpool, the White House -- that's pretty special," he said.
The concert is set to be televised July 28 on PBS.