Carlos Alcaraz of Spain returns the ball against Russia s Karen Kachanov during their match at the Madrid Open tennis tournament in Madrid, Spain, Wednesday, May 3, 2023. Photo: AP
The top seed, who turns 20 on Friday, fought his way back from 4-1 and 5-2 down in the second set to triumph in one hour 52 minutes.
Alcaraz blew away Alexander Zverev on Tuesday in a repeat of last year's final in the Spanish capital, but Khachanov put up stiffer opposition.
"Winning this match will give me a lot of confidence, Karen was at a great level and took me to the limit," said Alcaraz who unleashed 31 winners.
"It was decided by small details and I am very, very happy to be able to get through this round."
The Russian, who knocked out compatriot Andrey Rublev this week and also reached the Australian Open semi-finals, showed no fear in the first set despite his opponent's form.
Eventually Alcaraz found a decisive break to take a 4-3 lead with a strong forehand which Khachanov could not return successfully.
The Spaniard consolidated and served it out.
In the second set Khachanov broke for a 3-1 lead when Alcaraz went long after saving a first break point.
The world number 12 forced two more in the sixth game but could not convert either as Alcaraz fought hard to hold.
Alcaraz's perseverence paid off as he broke with a volley to get back on serve at 4-5.
The US Open champion consolidated his break and then earned another when Khachanov hit the net with an attempted forehand winner.
Aiming for his 10th tour level title the crowd-pleasing home favourite sealed his progress with a powerful forehand drive.
Alcaraz will face Daniel Altmaier or Borna Coric in Friday's semi-finals.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)