Diafra Sakho's second-half header was enough for West Ham to progress in the FA Cup at Bristol City's expense.
The League One club were the better side in the first period and had two efforts cleared off the line.
West Ham struggled to make chances, but good work from Andy Carroll set up Sakho to nod in at the far post.
Bristol City manager Steve Cotterill says he will have to wear the same pair of 'lucky' underpants for this weekend's FA Cup 4th round tie against West Ham that he had on for last weekend's league win.
"It's a load of nonsense really all of it...but I'll probably still stick to it," Cotterill said as he addressed the nation's media ahead of the League One leader's biggest test of the season.
The City manager is very candid about his pre match superstitions, which also include saluting magpies if he sees any on the way to games.
But on the matter of his underwear, the 50 year-old is quick to point out their cleanliness.
"They are washed...they're washed and ready to go again. They're not just left on the side for a week."