The seven-year-old boy who played a pint-sized Darth Vader in an advert that went viral underwent successful open heart surgery on Thursday, doctors said.

Max Page, who tried to use "The Force" on a series of objects - and an unimpressed family dog - in the ad for the 2011 Super Bowl championship game for American football, had the operation to replace a pulmonary heart valve at the Children's Hospital Los Angeles.

"The surgery today went very well," said CHLA's Heart Institute co-director Vaughn Starnes, who performed the surgery. "The surgery took two hours without complications, and he is recovering very well in cardiac ICU.

"We had to replace his pulmonary valve, and we did it without incident. We decided to use a porcine-manufactured valve and we used a small adult size for Max," he added.

Page is expected to remain in hospital until early next week, and recovery time is usually six to eight weeks, said hospital spokesperson Lorenzo Benet.

The boy, who was born with a congenital heart defect known as Tetralogy of Fallot, has been treated since he was an infant, and is now an official "junior ambassador" for the LA hospital.

His mother Jennifer Page said she was relieved the surgery went "extremely well," adding: "But on the healing side, we need all the prayers and all the encouragement we can (get)."