Germany took the silver and the Netherlands the bronze.
It was Britain's first dressage medal ever and capped an equestrian competition that saw the home team medal in every team discipline: gold in dressage and show jumping and silver in eventing.
"I hope it doesn't end here. I hope it's the start of the team evolving," said Britain's Laura Belchtolsheimer, who rode Mistral Hojris.
In dressage, the horse performs a carefully choreographed routine of movements that showcases the animal's training: prancing trots, extended strides, twirling pirouettes and a move called the flying change, which looks like the horse is skipping.
The competition received unusual attention in the London Games because the U.S. team featured Rafalca, a horse co-owned by the wife of the Republican presidential candidate Mitt Romney. The U.S. finished sixth and Rafalca, ridden by Jan Ebeling, ended Tuesday in 28th place and out of contention for the individual medal competition.
Ann Romney was in the VIP stands Tuesday as was Princess Anne, whose daughter Zara Phillips was part of the silver-winning British equestrian eventing team.
Germany has won every Olympic team gold in dressage since 1976, with the exception of the boycott year in 1980, and Britain has never won a dressage medal, period. In perhaps a first for any dressage event, which are usually rather staid affairs, the crowd in the stands went through several rounds of the wave after it became clear Britain had won.
The final team totals were Britain with 79.979 per cent, Germany with 78.216 per cent and the Netherlands with 77.124 per cent.
It was a back-to-back win for Britain, which won its first team show jumping medal in 60 years in the same arena on Monday. Led by Nick Skelton, who returned to the sport after breaking his neck in a 2000 competition fall, the British team rode clear rounds in a jumpoff to give the host team victory over the Netherlands. Saudi Arabia, a relative newcomer to the sport, was a surprising third.
The 18 highest scoring individuals in the team dressage competition advance to perform a freestyle test on Thursday, with movements and music of the rider's own choosing, similar to freestyle ice skating or the floor exercise in gymnastics.
Going into the freestyle event, Germany and Britain both have their three riders in the top eight, which also includes current world leader Adelinde Cornelissen from the Netherlands riding Parzival and the top U.S. rider, Steffen Peters on Ravel.
After Tuesday's Grand Prix Special, Britain's Charlotte Dujardin was in first place on Valegro with 83.286 per cent; Cornelissen was second with a score of 81.968 per cent and Britain's Carl Hester on Uthopia was in third place with 80.571 per cent.
Scoring for the individual medals starts from scratch on Thursday.
Margaret Freeman contributed.
Follow Nicole Winfield at www.twitter.com/nwinfieldSuggest a correction