The home side had the lead in the early stages when Joe Cole converted from close range, and that effort was all that separated the two teams at the interval.
Cardiff improved in the early stages of the second period, but they were 2-0 behind after 76 minutes when Kevin Nolan swept a calm effort into the top corner.
Here, Sports Mole dissects the action between the two Premier League rivals.
On target: 4
On target: 1
Was the result fair?
There is no question that West Ham deserved to secure all three points this afternoon. In truth, it was not a very entertaining occasion with both sides struggling for invention in the final third, but the Hammers did create the better chances. Cardiff might have felt that they could have taken something from the match after a bright start to the second period, but they were unable to make the breakthrough, registering just one attempt on target throughout the 90 minutes of football.
West Ham's performance
Professional rather than impressive from the Hammers. There will be tougher tests ahead for the home side that is for certain, but the three points were the most important aspect of their performance. They were guilty of looking long in the early stages, which without Andy Carroll, proved to be a problem. However, their two goals arrived from two genuine pieces of quality, which will quell some of the suggestions that the Hammers are purely a long-ball team. Based on their display and the quality they still have to come in, it could be a successful season for the London outfit.
Cardiff did not concede too many opportunities this afternoon, but they really struggled to force the issue down the other end. They will feel that their home performances will be the difference between staying up and going down this season, but you just get the feeling that boss Malky Mackay may look to add another striker before the end of the window. They stormed to the Championship title last season, but will find life much tougher at this level of football.
Sports Mole's man of the match
Mohamed Diame: In terms of box-to-box midfielders in the Premier League, there are not too many better than Diame. He was in imperious form for the Hammers this afternoon with Gary Medel simply unable to match his energy in the middle of the park. If he can stay fit, then West Ham will have a much better chance of securing a top-half finish this season.
Biggest gaffe of the match
Cardiff came to play football this afternoon, but the quality of their delivery was poor. Peter Whittingham, so often their saviour, delivered disappointing free kicks time after time, while each opportunity they had to deliver quality into the penalty box, it simply was not taken. The Welsh outfit may not have conceded too many chances, but they did not really threaten until the final five minutes.
Howard Webb was called upon to make a number of decisions in the first period, but the experienced Englishman made the correct call on each occasion. There was also a 10-minute spell in the first period when both sides were guilty of making a number of poor challenges, but Webb was on hand to calm proceedings.
West Ham: The Hammers will attempt to make it six points from two games when they travel to Newcastle United next weekend.
Cardiff: The Welsh outfit host Manuel Pellegrini's Manchester City side next Sunday afternoon.