Inter Milan survived a scare as it beat Empoli 3-2 after extra time on Wednesday to reach the Italian Cup quarterfinals.

It appeared as if Empoli was about to pull off an upset in the round of 16 when it went ahead with Nedim Bajrami's strike and an own-goal by home 'keeper Ionuț Radu after Alexis Sánchez’s opener for Inter.

More Images
Inter Milan's head coach Simone Inzaghi gives directions to his players during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan survived a scare as it beat Empoli 3-2 after extra time on Wednesday to reach the Italian Cup quarterfinals.

Inter Milan's Stefano Sensi, right, scores his side's 3rd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter, which leads Serie A, had rotated its squad to give several players a rest. But coach Simone Inzaghi was forced into an early change when Joaquín Correa limped off in tears with a suspected hamstring problem and was replaced by Sánchez in the fifth minute.

Inter Milan's Andrea Ranocchia, second from right, celebrates with teammates after scoring his side's 2nd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

And the turnaround was complete when a towering header from former AC Milan forward Patrick Cutrone bounced off the underside of the bar and in off the back of Radu’s leg.

Empoli's Patrick Cutrone, right, and Empoli's Kristjan Asslani celebrate their side second goal after an own-goal by Inter Milan's goalkeeper Andrei Radu, during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

The former Manchester United forward did have a hand in the goal in the 14th minute of extra time. Following a mistake by the Empoli defence, Sánchez set up Sensi — who had only just come on as a substitute.

Inter Milan's players react after Empoli's second goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

It next faces holder Juventus.

Inter Milan's Alexis Sanchez scores his side's first goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

Inter Milan's Joaquin Correa touches his leg during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Joaquin Correa touches his leg during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Sassuolo's Abdou Harroui celebrates with teammates after scoring his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui celebrates with teammates after scoring his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui  scores his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui scores his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

But Andrea Ranocchia leveled in stoppage time to send the match into extra time, where Stefano Sensi scored the winner. Inter will next play either Roma or Lecce — the only team outside Serie A left in the competition.

Inter Milan's head coach Simone Inzaghi gives directions to his players during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's head coach Simone Inzaghi gives directions to his players during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter, which leads Serie A, had rotated its squad to give several players a rest. But coach Simone Inzaghi was forced into an early change when Joaquín Correa limped off in tears with a suspected hamstring problem and was replaced by Sánchez in the fifth minute.

Sánchez had come off the bench to score a last-minute winner against Juventus in the Italian Super Cup last week. And he headed in a cross from Denzel Dumfries in the 13th minute.

Inter had chances to double its lead but Empoli began to get into the match and scored a deserved equalizer when Kristjan Asllani cut the ball back from the byline for Bajrami to control and fire into the bottom right corner.

Inter Milan's Stefano Sensi, right, scores his side's 3rd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Stefano Sensi, right, scores his side's 3rd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

And the turnaround was complete when a towering header from former AC Milan forward Patrick Cutrone bounced off the underside of the bar and in off the back of Radu’s leg.

Just as it appeared as though Empoli was about to pull off a shock result at San Siro, Ranocchia levelled with an acrobatic volley from 12 yards.

Sánchez thought he had scored the winner with almost the last kick of the match — as he had done against Juventus — but it was ruled out for offside.

Inter Milan's Andrea Ranocchia, second from right, celebrates with teammates after scoring his side's 2nd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Andrea Ranocchia, second from right, celebrates with teammates after scoring his side's 2nd goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

The former Manchester United forward did have a hand in the goal in the 14th minute of extra time. Following a mistake by the Empoli defence, Sánchez set up Sensi — who had only just come on as a substitute.

HISTORIC WIN

Sassuolo reached the quarterfinals for the first time in its history with a 1-0 win over Cagliari.

Empoli's Patrick Cutrone, right, and Empoli's Kristjan Asslani celebrate their side second goal after an own-goal by Inter Milan's goalkeeper Andrei Radu, during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Empoli's Patrick Cutrone, right, and Empoli's Kristjan Asslani celebrate their side second goal after an own-goal by Inter Milan's goalkeeper Andrei Radu, during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

It next faces holder Juventus.

Abdou Harroui scored the only goal of the game in the 18th minute. It was his first goal in Italian soccer after arriving from Sparta Rotterdam in August.

Cagliari had two goals ruled out for offside.

Inter Milan's players react after Empoli's second goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's players react after Empoli's second goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP_Sports

Inter Milan's Alexis Sanchez scores his side's first goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Alexis Sanchez scores his side's first goal during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Joaquin Correa touches his leg during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Inter Milan's Joaquin Correa touches his leg during an Italian Cup soccer match between Inter Milan and Empoli at the San Siro stadium, in Milan, Italy, Wednesday, Jan. 19, 2022. (AP PhotoAntonio Calanni)

Sassuolo's Abdou Harroui celebrates with teammates after scoring his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui celebrates with teammates after scoring his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui  scores his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)

Sassuolo's Abdou Harroui scores his side's first goal during the Italian Cup, round of 16 soccer match between Sassuolo and Cagliari, at the Mapei stadium in Reggio Emilia, Italy, Wednesday, Jan. 19, 2022. (Massimo PaoloneLaPresse via AP)