Joe Cole and defender James Collins were on target at the start of each half for the Premier League side.
Substitute Jabo Ibehre headed in a stoppage-time consolation with a powerful header.
Hammers boss Sam Allardyce selected a strong squad for the trip up the A12, with summer signing Adrian in goal and veteran Romania defender Razvan Rat in the XI, although England striker Andy Carroll is still not fit from a heel injury.
Colchester named on-loan Chelsea youngster Daniel Pappoe on the bench, while former Irons youngster Freddie Sears started in attack alongside one-time Premier League frontman Clinton Morrison.
West Ham were gifted an early lead on seven minutes when United goalkeeper Mark Cousins’ clearance bounced back into his own net off midfielder Cole.
Colchester responded well to going behind. On 21 minutes, Adrian, signed from Real Betis on a free transfer, saved a snapshot from Morrison, the former Crystal Palace and Birmingham striker.
The hosts were almost level when Gavin Massey cut inside from the left and curled a low shot just wide.
West Ham midfielder Matt Taylor played in 18-year-old striker Elliott Lee just before half-time, but Cousins was out quickly and produced a smart stop.
Centre-back Collins did make it 2-0 at the start of the second half when he headed home Cole’s corner on 50 minutes.
With 15 minutes left, substitute midfielder Jack Collison had a close-range effort saved by Cousins.
Ibehre’s goal with a powerful header from a right-wing cross by Tosin Olufemi proved the last action of the match.
The Irons, who kick off their Premier League campaign at home to newly-promoted Cardiff on August 17, are now set for a training camp in Germany which includes games against Mainz and Hamburg.