MANCHESTER, England — Get ready for Jose Mourinho vs. Pep Guardiola, part II.

Manchester United ended a run of three straight losses by capitalizing on two goalkeeper mistakes to beat third-tier Northampton 3-1 in the third round of the League Cup on Wednesday.

The reward wasn’t kind for United: A match against Manchester City in the last 16 next month and a renewal of the Mourinho-Guardiola rivalry that has been transferred from Spain to the north of England this season.

While Guardiola’s City was winning its ninth successive game of the season by beating Swansea 2-1 away, United labored again and needed a helping hand from Northampton’s error-prone goalkeeper and its strong bench to end the first blip of Mourinho’s tenure.

Northampton goalkeeper Adam Smith was penalized for picking up a back pass and United scored from the resulting free kick, Michael Carrick lashing home a shot after Wayne Rooney’s attempt was blocked.

United was pegged back by a penalty and then took the lead against through Ander Herrera in the 68th minute before Smith dallied over a clearance and was dispossessed by substitute Marcus Rashford, who scored into an empty net.

“I think the team was in control from the beginning,” Mourinho said. “The game could and should have been easier.”

Rooney was one of the few regulars to start for United and was handed a rare chance to lead the attack in the absence of Zlatan Ibrahimovic. Rooney missed a good early chance and finished the game on the right wing after Ibrahimovic and Rashford were thrown on by Mourinho, with United drawing 1-1 at that stage.

A victory over lower-league opposition will serve as only brief respite for Mourinho, who will be back under scrutiny if United loses to Leicester on Saturday after successive losses to Manchester City, Feyenoord and Watford in the space of nine days.

Gael Clichy and Aleix Garcia were the second-half scorers for a much-changed Man City side, which kept up its 100 percent start under Guardiola. Amid City’s nine-game winning run was an eye-catching 2-1 win at United.

Vincent Kompany started for City in his first game of the season after a thigh injury, but left the field seconds after Gylfi Sigurdsson pulled a goal back for Swansea in injury time. Kompany, City’s club captain, has been out since May 4.

“The doctors are speaking with him and seeing what’s up,” Guardiola said. “Hopefully, it will not be a big problem. We’re going to wait for the results from the doctors.”

Here’s a look at the other results on Wednesday that wrapped up the third round of England’s second-tier cup competition:


WEST HAM 1, ACCRINGTON 0

Struggling West Ham required a free kick by Dimitri Payet six minutes into injury time to overcome the lowest-ranked team left in the competition.

The France midfielder curled his shot over the wall and into the net, earning his team a home match against London rival Chelsea in the Olympic Stadium.

Accrington, which is in 11th place in the fourth tier, stifled West Ham comfortably before Payet’s late intervention. West Ham has lost four of its five matches in the Premier League, including the last two with 4-2 scorelines.


TOTTENHAM 5, GILLINGHAM 0

Vincent Janssen scored his first goal for Tottenham and Christian Eriksen netted twice in an easy win for Spurs against the third-tier visitors.

There were also goals for Josh Onomah — his first senior strike — and Erik Lamela late on as Tottenham secured a last-16 match at Liverpool.


ALSO

Hull beat Stoke 2-1 thanks to Markus Henriksen’s injury-time winner, Southampton defeated Crystal Palace 2-0, Sunderland came from behind to beat Queens Park Rangers 2-1, and Bristol City won 2-1 at Fulham.