Manchester United and Manchester City were kept apart in the draw for the Capital One Cup semi-finals.
The first legs will be played in the week commencing 6 January, with the second legs a fortnight later.
City and Sunderland will be at home first.
The draw means there will not be a repeat of the 2009-10 semi-finals, when Wayne Rooney's dramatic stoppage-time header saw United recover from a first-leg defeat by City to reach the final.
"It will be a tough semi-final," Manchester United manager David Moyes said. "Sunderland played well to beat Chelsea so anything can happen, but we are really pleased to be in the last four.
"This club is used to winning trophies, it is business as usual."
If the Manchester clubs make it through to Wembley, it will represent the first opportunity for Moyes and opposite number Manuel Pellegrini to win major silverware with their new clubs.
Moyes succeeded Sir Alex Ferguson at Old Trafford in the summer and went on to win the Community Shield in his first competitive game in charge, while Pellegrini replaced Roberto Mancini after the Italian was sacked in the wake of City's FA Cup final defeat by Wigan.
Pellegrini's men will have to overcome a West Ham side that claimed their second victory of the season at White Hart Lane.
Despite struggling in the Premier League, Sam Allardyce's side went through after Matt Jarvis and Modibo Maiga's late strikes ensured Tim Sherwood made a losing start as Spurs caretaker manager following the dismissal of Andre Villas-Boas.