MIAMI, FL, USA - Unseeded Monica Puig pulled off a second-round stunner at the Miami Open on Friday night into Saturday morning, as she upset No.2 seed Caroline Wozniacki after a first-set bagel, 0-6, 6-4, 6-4.

Puig pulled off the upset after losing the first seven games of the match, thrilling an increasingly partisan crowd past midnight to secure victory in one hour, 54 minutes - at 12:37 a.m.

In the fourth three-setter in five career meetings between the two, the Puerto Rican scored her second win in the matchup to set up a third-round meeting with Greece's Maria Sakkari. 

In addition, the victory ties Puig's career-best in terms of ranking, as she also defeated Angelique Kerber when the German was ranked World No.2 to win the gold medal at the Rio Olympics. 

"Honestly, this felt like Rio all over again," an emotional Puig said on-court after the match. "I've lived in Miami for so long, but my heart always belongs to Puerto Rico, so I really appreciate all the support.

"I've been waiting for this moment and finally to start finding myself again, and I just really appreciate all the support. It was incredible."

However, the eventual conclusion looked all but expected after an opening set that lasted 25 minutes. In it, Puig was unable to break through the Wozniacki defenses, and hit 18 unforced errors over the course of the first six games. 

The Puerto Rican also served under 50 percent for the set, which allowed Wozniacki several opportunities on the second serve return.

The Dane won nine of the 11 points played behind Puig's second serve, and converted all three break point opportunities that she created.

"I just tried to stay positive, I didn't think I did a lot wrong - a ball here or there that just missed the line," Puig added. "She's such a great competitor so I knew I had to stay in there, stay focused and keep fighting. I just found my way out there."

Puig battled hard to begin the second set, as she pushed Wozniacki to six deuces on serve and generated her first three break points of the match.

She was unable to convert, however, as Wozniacki held on in a service game that last over 10 minutes, but secured her first game in eight with an ace to emphatically hold her own serve. 

The Rio Olympic gold medalist went toe-to-toe with Wozniacki in the second set as she stayed even for four games and used aggressive, attacking tennis to move ahead by a break, 3-2. 

After saving two break points in her next service game, Puig's confidence behind her serve grew, and she was never threatened behind it again as she leveled the match at one set apiece.

Though the World No.82 also struck 18 unforced errors in the second set, she balanced out the figure with 13 winners and plenty of balls at or near the lines - unlike the opener, where she struck just four winners. 

The deciding set began squarely in Puig's favor, as she broke serve twice in emphatic fashion to open up a 4-1 lead, but she was forced to find her best tennis late.

An eight-point swing in Wozniacki's favor brought the set to 4-3. but Puig stood strong at the end of the match and dropped just one point in her final two service games to move through to the third round in Miami for the first time.

Read more: My Favorite Places - Florida with Monica Puig