As farewell parties go, this one ended in happy tears for the departing, though not without some gatecrashers threatening to ruin proceedings. David Beckham ended the playing part of his American adventure with a second consecutive MLS Cup, as LA Galaxy and Houston Dynamo stuck to the Hollywood script with a Galaxy win.

Galaxy won decisively in the end, largely thanks to two goals in five frantic minutes changing the game just after the hour mark. They fell behind just before half-time to a spirited Houston side, who were heatedly contesting the midfield battles and threatening to frustrate the supply lines to the dangerous Galaxy attacking tandem of Landon Donovan and Robbie Keane.

Houston had shown up with all the tools to spoil the Beckham (and possibly Donovan) farewell. After last year's toothless performance at the same stage and stadium, they had a much revived midfield capable of supplying their frontline. And they drew first blood – the Scotsman Adam Moffat lofting a ball over the top for forward Calen Carr to race through and slam the ball past Galaxy keeper Josh Saunders, who had looked shaky in his decision-making early on but could do little about the goal.

With space at a premium and the game played at a high tempo, Beckham was limited in his contributions early on, and Galaxy depended more on their hard-tackling central midfielder Juninho than the English No23. In footballing, rather than romantic narrative terms, the game went much as expected for Beckham, with the younger players around him defining much of the shape of the match.

One of those players changed the game for the Galaxy. Omar Gonzalez, the young defender whose absence had threatened to derail their season earlier in the year, and who had put in a typically solid performance here, got up to head a ball back across Houston keeper Tally Hall from the corner of the six-yard box and send a roar of relief around the stadium.

Sensing blood, Galaxy surged forward. A couple of minutes later, Keane had the ball in the net on a knockdown from a Beckham free-kick, but there was an infringement and Houston breathed again.

Not for long though, as a couple of minutes later Galaxy were in front. Ricardo Clark, playing in his first MLS Cup final after being injured for his last two chances, found himself penalised for a handball, and Donovan, stroked the resulting penalty low to the keeper's left, to cap what may be his last appearance in a Galaxy shirt. Houston rallied and threw on the veteran Brian Ching to try to force a goal but despite a couple of half chances, they were not truly troubling the LA side.

Finally as the game drifted into injury time, a ball over the top was chased down by Keane, who wriggled past Hall, and was clipped as he rounded the keeper. The Irishman stepped up and killed the game.

With the Cup secured, the Galaxy coach, Bruce Arena, took off Beckham, who seemed to hug every team-mate as he edged his way reluctantly from the field.

Before to the game, the LA Riot Squad supporters, at one time Beckham's nemesis, held up a banner aimed at their Houston counterparts in the opposite corner: "This is Los Angeles. We win trophies. Get used to it."

If they are to maintain something like a dynasty – a task Arena believes to be impossible within the forced parity of the MLS system – they will have to do so with a new lineup of leading lights, with Donovan perhaps feeling that this win makes for a natural break in his career, if not retirement, and Beckham leaving.

The tractor beam of media attention had been drawn relentlessly to Beckham all week, following the announcement of his departure.

He is not the key player on this Galaxy team – Keane, with six goals in these play-offs, or Donovan, the best American player of his generation, can make more legitimate claims. But for better or worse, he has been the face of this team since 2007, and leaves with a second successive championship.

After last year's final, which Galaxy also won, Beckham elected not to take up an offer from Carlos Ancelotti's newly minted Paris St-Germain and to play another year in LA.

It is a decision that bought him a definitive sporting encore to depart on. As for what is next, Beckham mentioned Ancelotti again this week, as a coach who has spoken highly of him, along with Harry Redknapp and Sam Allardyce.

Other rumours say Australia, or China. Wherever he goes next, this particular exit may not be final – Beckham has been strongly linked with exercising his contractual right to buy a low-priced MLS franchise, by buying into the Galaxy themselves.

That is for a future act in the movie however. This one ended in a trophy being kissed.