Daley dived twice from 10m and once from 3m, while Gallantree completed the reverse routines.
They scored 434.65, with Ukraine (426.45) winning silver and China (425.40) bronze in Kazan, Russia.
Britain won bronze on Tuesday in the synchronised 3m springboard.
It is the first time Britain has claimed two medals at a World diving championships and Gallantree becomes the first British female to win a medal at World level.
"We didn't have any expectations ahead of the competition as we know China is so strong and it felt surreal to be competing and, the next thing, we're on top of the podium," said Olympic bronze medallist Daley.
"It's an insane feeling and thanks to Becky for diving so well."
Gallantree said she could not believe she and Daley had won, saying: "We came in for a bit of fun and to practise ahead of our individual events, but it became a bit more than that.
"I never thought I would be a world champion and it's amazing to say now that I am."
Earlier on Wednesday, Olympian Tonia Couch qualified for Thursday's individual 10m platform final and in doing so secured Team GB a place in the event at the Rio Olympics.
The British pair were in third after the first round of an event which featured China's multiple world champion Ruolin Chen and USA's London 2012 10m champion David Boudia.
Two stunning routines by Daley and solid performances from Gallantree saw them move clear of their opponents in the final rounds.
Daley was using the non-Olympic Team event as a warm-up before his individual 10m platform campaign begins on Saturday.
Gallantree, who came 10th alongside Alicia Blagg in the synchronised 3m springboard final on Saturday, will compete in the individual 3m event on Friday.
British divers have claimed their second medal of the World Aquatics Championships with Tom Daley and Rebecca Gallantree combining to win gold in the team event.