May 7, 2022 | 7:41pm

A formula for success.

Michelle Obama stopped by the Miami Grand Prix on Saturday where she embraced Mercedes Formula 1 driver Lewis Hamilton.

The former first lady was seen giving the seven-time world champion a big hug ahead of his third practice session at the Miami International Autodrome.

Hamilton, 37, closed his eyes as he returned the warm greeting. They were also seen chatting and laughing, appearing to be equally starstruck by each other.

Obama, 58, was wearing a headset, a crisp white shirt with a beaded collar, and wide-framed sunglasses as she watched qualifying from the Mercedes garage.

Hamilton was sixth fastest in the session while his Mercedes teammate George Russell failed to make it out of Q2 and starts in 12th tomorrow.

Ferrari’s Charles Leclerc and Carlos Sainz will lock out the front row of the grid, with reigning world champion Max Verstappen rounding out the top three. 

Michelle Obama and Lewis Hamilton
They were seen chatting and laughing with each other in the Mercedes garage.
AFP via Getty Images

“The fans are crazy it is incredible to be here. It will be a tight challenge tomorrow but hopefully we can come out on top,” championship leader Leclerc told reporters after the race. 

Meanwhile, Hamilton said it was “nerve-wracking going into qualifying.”

“We don’t know why we were looking faster than we were … we’re not going to take a step forward, we’ve just got to put the work in,” he told reporters.

Elsewhere on the track, Dax Shepard and YouTuber Noel Miller were spotted watching from the Red Bull Energy Station, where the music was pumping and drinks were flowing.

Michelle Obama and Lewis Hamilton
They came together in the Mercedes garage.
Getty Images

Post Malone, who recently announced he’s expecting his first child, made an appearance at the Hard Rock Beach Club, where he performed hits like “Better Now” and “Congratulations.”

The Grammy winner even paid homage to McLaren driver Daniel Ricciardo by drinking a beer from someone’s shoe: affectionately dubbed a “shoey.”

Paris Hilton was spotted in the Paddock Club, along with “Bachelorette” alum Dale Moss, who appeared to be joined by two women.

James Corden spent his third day in the paddock, where he’s filming a segment for “The Late Late Show” with Ricciardo and his teammate, Lando Norris.

Michael Strahan was also spotted in the McLaren hospitality area after stopping for selfies with fans.