* Phelps ends Olympics career with 23rd gold
* Coach says he's 'once in 10 generations' swimmer
* Blume wins Denmark's first swimming gold since 1948
* U.S. women win medley relay for 1,000th gold
* World champion Paltrinieri powers to 1,500m gold
Denmark's Pernille Blume beat a field of world and Olympic champions to take gold in the women's 50 freestyle and Italy's Gregorio Paltrinieri won the men's 1,500 freestyle after dominating almost from the start.
But it was Phelps who stole the show yet again when he sprang from the block to swim the butterfly leg of the 4x100 medley relay, recapturing the lead from Britain and setting up yet another U.S. victory, after Ryan Murphy had led off by breaking the world backstroke record.
"I walked to the pool tonight and I almost felt myself starting to cry - the last warm-up, the last time putting on a suit, the last time walking out in front of thousands of people representing my country," Phelps, 31, said of his final swim in his fifth Olympics.
He ended the week with five golds and a silver, improving on his tally in London four years ago when he came away with four golds - half his tally in Beijing in 2008 - and felt he had failed to do himself full justice, prompting him to come back from retirement in 2014.
"This is the way I wanted to finish my career," he said.
His career medal haul of 28, including three silvers and two bronze, is 10 higher than Soviet gymnast Larisa Latynina, the second most-decorated Olympic athlete.
Phelps' long-time coach Bob Bowman said swimming was unlikely to see anyone of his sort again.
"Absolutely not. I'm not even looking. He's too special," Bowman said when asked if he was now hunting for someone to take Phelps' mantle.
"It's not even once in a generation; it's maybe once in 10 generations that a Michael Phelps comes along."
Murphy, who completed a backstroke sweep with victory in the 100 and 200 events as well as the medley relay, added he felt breaking Aaron Peirsol's world record in the leadoff of Phelps' final race was especially poignant.
"To do it in one of the most watched races in the history of swimming, Michael's last race - that's something I am going to cherish forever," Murphy said of the 51.85 seconds he swam to eclipse Peirsol's 51.94 set in the bodysuit era in 2009.
The Americans completed a haul of 33 medals in the pool including 16 golds, with Australia and Hungary trailing on three golds each.
Britain took the relay silver, with 100 breaststroke champion Adam Peaty swimming a storming second leg to haul his team up from sixth place to first, and Australia won the bronze.
In the previous race, Simone Manuel anchored the U.S. women's 4x100 metres medley team to the 1,000th gold medal in her country's Olympic history.
"It's really special and the fact that I can do it with a relay is amazing," she said after the U.S. women beat Australia and Denmark.
"Just sharing that with three other women is just icing on the top of the cake... It's a nice number."
It was Manuel's second gold in the space of three days, adding to the 100 freestyle she claimed on Thursday, and came about 40 minutes after she took silver in the 50 free.
Denmark's Blume won that race in 24.07 seconds, winning by 0.02 seconds from Manuel, with Aliaksandra Herasimenia a further two-hundredths of a second behind in third.
Ranomi Kromowidjojo, the 2012 Olympic champion from the Netherlands, finished sixth while Australia's Campbell sisters Cate and Bronte again failed to win medals in an individual sprint.
The gold was Denmark's third in swimming, and the first since 1948.
Italy's Paltrinieri won the 1,500 metres freestyle after dominating throughout the race with a relentless display of technique and endurance in the longest event in the pool.
Connor Jaeger of the U.S. took the silver, and Italy's Gabriele Detti won bronze after overhauling Jordan Wilimovsky of the U.S. in the closing stages.
The winner, however, never seemed in doubt after world champion Paltrinieri took the lead at 150 metres and wore down the rest of the field to win by 4.91 seconds.
"It's incredible. Really. I have been dreaming of this moment since I was a child and it's amazing," the 21-year-old said.
"There was a lot of pressure on my shoulders. Italian people really wanted this gold and it was more difficult than I expected."