The duo from Waterloo, Ont., were the favourites going into Shanghai having won all five international events they competed in this season, including the Grand Prix Finals and Four Continents Championships.
Gabriella Papadakis and Guillaume Cizeron of France registered the first major surprise of the meet, vaulting from fourth place to win the gold with an expressive, passion-filled free dance performance.
Americans Madison Chock and Evan Bates took the silver medal.
Toronto's Piper Gilles and Paul Poirier of Unionville, Ont., were sixth while Alexandra Paul of Midhurst, Ont. and Toronto's Mitchell Islam finished 14th.
Defending champions Anna Cappellini and Luca Lanotte of Italy finished fourth.
In the men's short program, defending champion Yuzuru Hanyu overcame a fall on his opening quad toeloop to take the lead with 95.20 points, nearly three points ahead of Javier Fernandez of Spain. Nam Nguyen of Toronto was ninth while Jeremy Ten of Vancouver was 15th.
Weaver said the result will motivate the pair as they prepare for the 2018 Olympics.
"This sport is a marathon, not a sprint," she said. "This is only the first year of the next quadrennial. So this momentum will not last. It just makes us hungrier to work even harder and peak at the right time and make sure the next four years are ours."
She shook her head in disapproval when their scores came up on the screen.
The Canadians finished with 179.42 points while Papadakis and Cizeron recorded 184.28. Chock and Bates scored 181.34.
"We went out there and we gave it all that we had," said Poje. "We are a little disappointed with our score ... but we are very pleased with ourselves and with the way we skated."
The ice dancing competition lost some of its lustre this year without Americans Meryl Davis and Charlie White, and Canadians Tessa Virtue and Scott Moir, who have dominated the event over the past four years, splitting four world titles and two Olympic golds.
Neither pair has competed since the Sochi Olympics last year, but they also haven't confirmed their retirements leaving open the possibility of a return.
The young French duo — Papadakis is 19 and Cizeron 20 — have made remarkable progress since moving up to the senior level last year, winning the European Championships, two Grand Prix events and now the world title. Last year, they were only 13th at the world championships.
"It is like a dream," Cizeron said. "We cried when the scores came up and we saw our placement."
Skating to Mozart's "Concerto No. 23," Papadakis and Cizeron turned in an elegant performance that ended with Papadakis swinging with legs extended from Cizeron's neck and then collapsing in his arms on the ice. They received four scores of perfect 10.00 from the judges.
"It's a big surprise to be here right now," Papadakis said. "Our goal at the beginning of the season was to be top 10 (at the worlds) so it's a big improvement."
Hanyu only had a few weeks to prepare for his title defence after undergoing surgery on his bladder in late December and then spraining his ankle, keeping him off the ice for two months.
The Japanese skater cleanly landed the rest of his triple jumps.
Nguyen is a former world junior champion.
"It's really enjoyable to perform in front of a big crowd," said Nguyen. "It's very cool for me to communicate my program to them."
— With files from The Canadian Press