Newcastle avoided a major upset against fourth-tier Newport County in the English League Cup by equalizing in the 87th minute and winning a penalty shootout to reach the quarterfinals on Wednesday.

Jonjo Shelvey took the game to spot kicks with a curling shot into the top corner, and Newcastle recovered after an early miss by Joelinton in the shootout to prevail 5-4.

Newcastle goalkeeper Mark Gillespie gifted the underdogs a fifth-minute opener by letting a tame shot from the edge of the area by Tristan Abrahams squirm through his grasp into the net.

Newcastle's Jonjo Shelvey, right, celebrates after scoring his side's first goal during the EFL Cup 4th round soccer match between Newport County and Newcastle United in Newport, Wales, Wednesday, Sept. 30, 2020. (Alex PantlingPool via AP)

Newcastle's Jonjo Shelvey, right, celebrates after scoring his side's first goal during the EFL Cup 4th round soccer match between Newport County and Newcastle United in Newport, Wales, Wednesday, Sept. 30, 2020. (Alex PantlingPool via AP)

Gillespie made partial amends by saving one of Newport's penalties before Brandon Cooper blazed what proved to be the last attempt over the crossbar.

Newport was looking to reach the last eight for the first time in its 108-year history.

Later Wednesday, Manchester City continued the defense of its title at Burnley, while Manchester United visited Brighton and Everton hosted West Ham in other all-Premier League matchups.

Newport's manager Michael Flynn, left, comforts Newport's Brandon Cooper, center, after the EFL Cup 4th round soccer match between Newport County and Newcastle United in Newport, Wales, Wednesday, Sept. 30, 2020. (Nick PottsPool via AP)

Newport's manager Michael Flynn, left, comforts Newport's Brandon Cooper, center, after the EFL Cup 4th round soccer match between Newport County and Newcastle United in Newport, Wales, Wednesday, Sept. 30, 2020. (Nick PottsPool via AP)

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