(CNN) -- Serena Williams stayed on course to become the first woman to win the Miami Masters six times but only just, after surviving a major scare against Dominika Cibulkova.
At one point, the 13th seed from Slovakia led 6-2, 4-1 and seemed to have one foot in the quarterfinals until Williams, 31, displayed the fighting qualities that have made her one of the greats of the game.
The world No. 1 rallied to win 2-6, 6-4, 6-2 and so book her place in the last eight, where she will take on China's Li Na, the fifth seed.
"I just thought to myself, 'Well, I've been down worse. It's nothing new. Just keep fighting'," Williams -- whose five crowns are equaled only by Steffi Graf -- told reporters in Key Biscayne.
"I never give up. It doesn't matter whether it's in life or on the tennis court -- I keep fighting."
"I was playing a really good opponent who plays really well. She's a good fighter and a great player," added the American, who is seeking her first Miami title to add to those won in 2002-2004 and 2007-2008.
Unfortunately for Cibulkova however, the defeat marked the second year in a row where the 23-year-old has led the world's best by a significant distance in Miami only to fail to make it over the finish line.
In 2012, the right-hander led Victoria Azarenka 6-1, 5-2 before succumbing to defeat.
Meanwhile, Na was unconvincing as she made 39 unforced errors in a straight sets defeat of Spanish teenager Garbine Muguruza (7-6, 6-2).
Playing her first tournament since injuring her ankle at January's Australian Open, Na let both a 5-1 lead in the first set -- and then a 6-1 lead in the tie break -- slip before dismissing the 19-year-old who had knocked out Caroline Wozniacki and Anastasia Pavlyuchenkova.
Defending champion Agnieszka Radwanska also had trouble making it through as the fourth seed recovered from losing the first set before seeing off the challenge of rising talent Sloane Stephens with a 4-6, 6-2, 6-0 win.
Next up for the Pole is Belgium's Kirsten Flipkens, who saw off Croatia's Ajla Tomljanovic 6-7, 6-4, 6-3 to continue her best start to a season -- as she reached her fourth quarterfinal of the year.
In the men's section, second seed Andy Murray saw off the challenge of Grigor Dimitrov in straight sets (7-6, 6-3) after the Bulgarian also let a decent lead slip.
The 21-year-old had the chance to win the first set when serving at 5-3 but three double faults handed the Scot a lifeline.
It is the second time in as many tournaments that Dimitrov has cracked when serving for a set against a top-ranked player, having served four double faults when leading world No. 1 Novak Djokovic 5-3 at Indian Wells earlier this month.
Murray will face Italy's Andrea Seppi in the quarterfinals.