Andy Murray will face old rival Novak Djokovic for the first time in over a year after beating Canada's Denis Shapovalov at the Madrid Open.
Murray defeated the world number 16 by a score of 6-1 3-6 6-2 at Wimbledon last year.
The test against world number one will be even tougher on Thursday.
Serbia's Djokovic started his campaign on the Madrid clay with a 6-3 6-2 win against France's Monfils.
He will play Murray in the last 16 and he has known him since they were children.
Murray told Amazon Prime that he didn't know he'd get opportunities to play matches like this again. I should not have a chance in the match.
I have worked my hardest, put myself in a great position and it is a great opportunity to play against him again on a big court.
The Scot had originally planned to skip the clay-court season but changed his mind last month.
Murray had the chance to avenge his Wimbledon defeat against Shapovalov after beating Thiem in the first round.
The highlight of the first set was when Murray raced from the baseline to the net to win a cross-court game.
After a tight start to the second set, Shapovalov fought off two break points at 2-2 and then took Murray's serve in the very next game to level the match.
The deciding set was decided by Murray's trademark determination and his fitness levels.
He sealed victory with his third match point at 12:34am local time and then went on to win his second match in a row.
The victory ensured that he will remain at the top of the rankings, and also extended his 100% winning record over MonFils to 18 games.
The 20-time Grand Slam champion was not allowed to compete at the Australian Open and the United States because he was unvaccinated against Covid-19.
"I'm still finding my form and my rhythm but I'm happy."
Britain's Jack Draper, 20, fell short of an upset against world number eight Andrey Rublev after being up in the third set.
This prestigious Masters 1000 event is where world number 121 Draper brought his winning streak onto the clay after winning four titles on the Challenger circuit this year.
Rublev could face Dan Evans next after he beat Draper.
In his first match against Lorenzo Sonego on Sunday, the left-handed Draper was in control until he was taken to a third set by the Russian Rublev.
He was pegged back as his first serve lacked consistency and Russian Rublev, playing under a neutral flag because of sanctions relating to Russia's invasion of Ukraine, increased his level to win the contest after two hours and 19 minutes.
At Wimbledon last year, he took a set off the eventual champion and also stunned Italian third seed Jannik Sinner at Queen's and his two performances in Madrid are further evidence of a promising future.