She was cozying up with her former fiancé Ben Affleck in steamy Miami only days earlier.

But it was back to the gym in the same city for Jennifer Lopez on Friday as she returned to her usual intense workout regimen.

The 51-year-old actress and singer highlighted her enviable figure and toned legs with an eye-catching set of gleaming magenta leggings.

Back at it: Jennifer Lopez, 51, showcased her toned figure in sparkling magenta leggings while hitting the gym again in Miami on Friday

The high-waisted pants had a metallic sheen to them and also covered up her well-defined abs.

Jennifer also showed off a hint of her midriff thanks to her mauve off-the-shoulder crop top, which dipped past one shoulder and showed off her bra straps in the same shade.

The 5ft5in beauty stayed on the sporty theme with a pair of chunky white trainers.

She tied her caramel-colored tresses back in a tight bun to showcase her large hoop earrings, and she completed her look with large pink-tinted square aviator sunglasses.

Sporty style: Jennifer also showed off a hint of her midriff thanks to her mauve off-the-shoulder crop top, which she contrasted with chunky white trainers

Going solo again: She had a companion earlier this week when Ben Affleck joined her at the gym while they enjoyed a romantic getaway in Miami

The Hustlers star appeared to be joined by a trainer as she headed into the gym.

She had a gym companion earlier this week when Ben Affleck joined her while they enjoyed a love getaway in the coastal Florida city.

The on-again lovebirds were seen ‘holding hands, hugging, kissing,’ a source told People on Thursday. ‘They are very much into each other and being together’ and ‘weren’t trying to hide the fact that they were together.’

Another source told the publication that Ben and Jennifer ‘are both excited about their relationship’ and that they ‘don’t want to hide anymore.’

The Argo actor and director is now back in Los Angeles, where he was seen taking his son Samuel to swim lessons on Saturday.

Location has always been a non-negotiable factor for Ben, who is committed to being in LA to spend as much time as possible with his three children, whom he shares with his ex-wife Jennifer Garner.

Amicable exes: Jennifer was spotted with her ex-husband Marc Anthony over lunch on Thursday. She shares her 13-year-old twins Emme and Max with the singer

The If You Had My Love singer has two children of her own, 13-year-old twins Emme and Max, whom she shares with her ex-husband Marc Anthony.

The two singers reunited on Thursday for a relaxing catch-up lunch in Miami, where they were spotted dining outdoors together after her gym session.

The two were married in 2004 and divorced a decade later in 2014.

New/old love: Jennifer has recently reunited with her former fiancé Ben Affleck, and the two were seen on getaways to Montana and Miami following her split from Alex Rodriguez; seen together in 2003

Jennifer’s renewed connection with Ben appears to have begun even before she broke off her engagement with fiancé Alex Rodriguez in April, as the couple started sending emails back-and-forth even earlier.

The Gone Girl star was later seen getting picked up in her SUV and shuttled to her LA home several times.

The actors first met in 2001 on the set of their box-office bomb Gigli, and they made their relationship official the following year, shortly after Jennifer divorced her second husband.

They got engaged later in 2002 and scheduled their wedding for September 2003 but called it off with only a few days notice.

Ben and Jennifer then split in early 2004, but reportedly remained friends afterward, which may have helped them get close again.

Watch out, Ben! Jennifer’s ex Diddy showed he still had fond feelings for J.Lo after posting a playful throwback to Instagram of their two decades–old relationship on Thursday

But Jennifer’s ex Diddy came out of nowhere on Thursday with a throwback post featuring himself and the Maid In Manhattan star from their own romance, which last from 1999 to 2001.

The 51-year-old hip-hop mogul was pictured holding hands with Jennifer in the photo while decked out in a gray sweatsuit from his Sean John clothing label.

His relationship with Jennifer ended on a sour note, as she received a weapons charge after a club altercation — which was swiftly dropped — though he had to go to trial before being acquitted on all charges.

Since then, the two have remained friends, though that didn’t stop him from seemingly giving her new beau a hard time.