Rune and Medvedev set up quarter-final showdown, Ruud battles past Monfils
Rune surrendered the opening set in 32 minutes and looked down for the count when 2022 winner Fritz went up 5-4 and 40-30 in the next, but the seventh seed produced a vital hold before forcing a tiebreak.
The Dane stepped up a gear to level the contest at one set all and broke his American opponent for the first time with some blistering shotmaking for a 3-1 lead in the decider.
With Fritz wilting in the California desert, Rune completed the comeback by closing out the match on serve, finishing with a fiery forehand winner.
"It was crazy. I really just stayed in the moment and kept fighting, trying to play better point to point and I managed to raise my level quite amazingly at the end of the second set, which meant everything for the match," Rune said.
"He was controlling it in the first set and for a long time in the second as well, so I'm just happy I could keep fighting. I kept believing I was going to find my rhythm at some point. It was on the edge but I managed to find it, which was nice."
Up next for Rune is last year's runner-up Medvedev, who outclassed Grigor Dimitrov 6-4, 6-4 with a near-flawless display to stay on course for his first title of the year after falling in the Australian Open final.
Rune, who split his two career meetings with the Russian last year, said he would come out all guns blazing.
"I'm a player that's going to attack. I don't care who I play, I'm going to attack anyways," Rune said.
"Against Daniil it's a completely different match from today. The only similarity between him and Fritz have is the big serve. Fritz is close to the baseline while Medvedev is far.
"Medvedev on this surface is dangerous like Fritz. I'm just going to recover and believe in myself like I did today."
Earlier, Casper Ruud ended Frenchman Gael Monfils's run with a 3-6, 7-6(3), 6-4 victory and plays Tommy Paul after the American brought lucky loser Luca Nardi back down to Earth.
After struggling to put winners past the athletic Monfils in the first set, the Norwegian ninth seed became more aggressive in a tight second and rolled through the tiebreak.
Ruud finally broke his 37-year-old opponent for a 3-1 lead in the deciding set and cruised to the finish.
A nice moment came when Monfils walked to the service line trailing 3-5 in the third and the crowd rose to cheer on the fan favourite, who smiled and waved his racket in appreciation before holding serve.
After stunning his idol Novak Djokovic on Monday, 20-year-old Italian Nardi was served a dose of reality by Paul, who hit five aces and never dropped serve en route to a 6-4, 6-3 win.