The £128m deal is understood to comprise his salary, existing sponsorship contracts, merchandising shirt sales and a share of the club profits.
In a statement, Beckham continued: "I would like to thank the supporters and people of Madrid who have made my family and I feel so welcome in my time here, making this an extremely difficult decision to make.
I am proud to have played for two of the biggest clubs in football
"I have enjoyed my time in Spain enormously and I am extremely grateful to the club for giving me the opportunity to play for such a great team and their amazing fans.
"I am proud to have played for two of the biggest clubs in football and I look forward to the new challenge of growing the world's most popular game in a country that is as passionate about its sport as my own.
"For the rest of this season I will continue to give 100% to my coach, team-mates and fans as I believe manager Fabio Capello will bring this club and its supporters the success they truly deserve."
LA Galaxy general general manager Alexei Lalas believes Beckham's arrival will give worldwide exposure to the high standard of football in America.
He told BBC Five Live: "One of the interesting things that I think people are going to see, is first off, the attention he's going to bring to the sport and to American soccer.
"People are going to see the quality that exists over here, and I fully recognise that many people over in England don't have a grasp of what's going on with major league soccer on or off the field.
"But the fact is that we have competitive teams, competitive individual players and a very good and growing league. It's not that we can't get better and I would put our teams up against some Premiership teams in a second"
Real Madrid confirmed Beckham's departure in a statement, saying: "Both parties have agreed that Beckham will not extend his current contract, which ends on 30 June 2007."
Beckham left Manchester United in July 2003 to sign for Real, who paid £25m for the midfielder's services.
However, in the three-and-a-half seasons since his arrival, the Spanish giants have failed to win any major trophies.
This season has proved particularly disappointing for Beckham, who was dropped by England coach Steve McClaren and then fell out of favour with Real boss Capello.
How the BBC Sport website broke the news in November
LA Galaxy admitted their interest in signing Beckham in November, when general manager Alexi Lalas told the BBC Sport website of his admiration for the former England captain.
In an exclusive interview, Lalas said: "The Los Angeles Galaxy are looked upon as the jewel of Major League Soccer.
"We play in the best stadium, we have had incredible success over the history of the league, we have had great individual players and great teams. There's a tradition of excellence.
"All of this leads to this race to become the first MLS super club, if you will."
Beckham is the biggest name to sign up for Major League Soccer since its inception in 1996 and the most famous player to play club football in the US since Pele, George Best, Franz Beckenbauer and Johan Cruyff competed in the North American Soccer League in the 1970s and early '80s.
LA Galaxy are owned by sports and entertainment giants AEG, who are also partners in Beckham's soccer academy in Los Angeles.
AEG president Timothy J. Leiweke said: "David Beckham will have a greater impact on soccer in America than any athlete has ever had on a sport globally.
"David is truly the only individual that can build the 'bridge' between soccer in America and the rest of the world."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.