The world number one took the first set with a single break of serve, defending well as she saved three break opportunities held by Li.
Williams was pushed even harder in the second as fifth seed Li raced into a 5-2 lead after the American lost her serve for a second time.
Li was unable to close out the set, however, with it going to a tie-break in which Williams held firm to win the match 6-3 7-6(5) and set up a semi-final against Radwanska, who beat Kirsten Flipkens 4-6 6-4 6-2 later in the day.
"She plays so well - we always have such intense matches," Williams said.
"I love it - she always improves, and that always keeps me motivated. I just had to get more consistent and hang in there."
Li was disappointed not to have grabbed her opportunities better.
"I had chances but I didn't hold," Li said. "She's the best player in the world, so if you don't take your chances, she will never give you a chance again.
"But I still have to see it in a positive way. I played well here. I just have to continue to work with my team and get ready for the clay court season.
"I'm looking forward to the clay court season because I'm healthy and hitting the ball well."
Radwanska had to come from behind to topple Flipkens, who looked on course for an upset after a promising opening set.
But Pole Radwanska, seeded fourth, rallied to claim the next stanza before sealing her 23rd win in 27 matches this year.
WTA Miami results
4-Agnieszka Radwanska (Poland) beat 30-Kirsten Flipkens (Belgium) 4-6 6-4 6-2
1-Serena Williams (U.S.) beat 5-Li Na (China) 6-3 7-6(5)