The draw was made on Friday lunchtime and the Magpies - who finished top of Group A - were paired with the Hammers.
Coincidentally, the two sides meet at St. James' Park in Premier League 2 on Monday night (kick-off 7pm). Admission is free to season ticket holders and members, otherwise £3 for adults and £1 concessions.
The date and venue for the Premier League Cup tie will be announced on nufc.co.uk in due course. It is likely to be played later this month.
The full draw for the last 16 is:
Portsmouth v Sheffield UnitedBrighton & Hove Albion v Huddersfield TownNewcastle United v West Ham United Reading v Middlesbrough or Charlton Athletic Hull City v Liverpool Norwich City v Fulham Swansea City v Blackburn Rovers Sunderland v Colchester United