Boro were unchanged following their midweek 2-0 win over Manchester City while West Ham gave forward Freddie Sears his first start of the season.
Sears raced away in an early counter-attack and shot past the far post with a scoring chance.
Central defender Chris Riggott cut out the danger from another fast West Ham move with a brilliant challenge.
The visitors went ahead through Hayden Mullins from a pass by Luis Boa Morte. Mullins beat Ross Turnbull with a shot that struck the angle of an upright and a crossbar.
Despite spraying the ball around in the early stages Middlesbrough showed no cutting-edge and West Ham began to gain in confidence. They looked the more dangerous side with Wales captain Craig Bellamy a live-wire in attack.
Boro were being over-run in midfield at this stage and no doubt manager Gareth Southgate will look to strengthen this department in the January transfer window.
It was an anxious time for Southgate with his side struggling.
Mullins shot high and wide for the visitors while goalkeeper Robert Green palmed the ball away from the head of Boro striker Afonso Alves as the Brazilian threatened at the far post.
Middlesbrough fans were not happy with the first-half performance of their team and some boos rang out as the teams walked off the field.
The Teessiders needed to improve in the second half if they were to pull the game around. Didier Digard lost possession to Bellamy but fortunately for Boro, Riggott was able to cut out the danger.
Jack Collison should have increased the lead for West Ham when Bellamy laid on a perfect chance but Turnbull was quick to the challenge.
Mido was introduced after 67 minutes for a disappointing Alves and his introduction had an important impact.
Green brought off a brilliant save from a fierce Gary O'Neil shot while at the other end second-half substitute Justin Hoyte beat Green with a header shortly after but he was ruled offside.
With seven minutes to go, Mido was fouled just outside the box. The former Spurs player picked himself up and crashed a powerful shot through the wall of defenders.
In stoppage time, two brilliant Turnbull saves from substitute Lee Bowyer and Collison prevented West Ham from snatching only their second win at the Riverside Stadium.