The 18-year-old frontman impressed during a recent trial period with the Hammers and will seal his switch from the League One club on Wednesday.
Sam Allardyce has only one striker available in Carlton Cole, with club-record signing Andy Carroll still a couple weeks away from a return.
Gordon, who made his first-team debut for the Posh last September at the age of 16, has made seven appearances for the London Road outfit.
He scored twice in the Hammers' Barclays U18 Premier League victory over Aston Villa, while also netting in first-team friendlies against Gillingham and Millwall during the November international break.
Recently Gordon notched the winner for Peterborough in the FA Youth Cup at Wolves, helping Posh to maintain their cup run.