Zverev, who has burst into life after a hard season, missed five match points in the second set, with Federer finding some magic to recover from 40-0 at 6-5 and then saving two more match points in the tie-break.
Earlier, world No. 1 and defending champion Djokovic lost 3-6, 7-5, 6-3 to 21-year-old Stefanos Tsitsipas.
Fognini beat seventh-seeded Karen Khachanov of Russian Federation 6-3, 7-5.
Medvedev won a tight first set then managed to recover in the second after failing to serve it out at 5-4.
Zverev is the slight odds-on favourite to win this match at 9/13, whilst Berrettini is priced at 11/8. The German also exhibited similar body language on Friday against Federer and, despite losing five match points in the second set, achieved his first Top 10 win of the year with a 6-3, 6-7 (7), 6-3 win."I told him at the net that he showed great character, that he was strong".More news: North Carolina confirms 2nd death from Legionnaires' disease
Medvedev has now reached a tour-leading nine finals in 2019.
"It's something I could never have dreamed of", the world number four said of his sixth final on the trot. Indeed, no one else has made it to more than five.
Opening the schedule is Tsitsipas against Medvedev, with the Russian, Medvedev actually taking a 4-0 head to head lead into the clash, although Tsitsipas has taken a set in every single clash. The 38-year-old Swiss served an ace to force a third set, during which he was penalised in the fourth game for twice hitting the ball out the court in anger.
The two youngest Masters champions will collide in the Shanghai final Sunday in China.
Tsitsipas said: "I don't know if I'm going to be able to beat him the next time or the time after that one, but I know there's going to be a time where I'm going to find opportunities and beat him".More news: Ex-Ecuador president wants new vote, denies planning coup
I lacked, you know, that little bit of, I guess, dynamic movement and acceleration in my shots.
Serving for the match at 5-4, Medvedev conceded a break after committing four errors.
"He's different this year", Zverev said. I didn't have any breakpoints for two sets. I felt like I've played some decent tennis this week and being in a Masters 1000 final here in Shanghai is also something very special for me.
"I'm looking forward to it and hopefully I can play some good tennis".More news: Rebekah Vardy had run-ins with me too, says WAG Danielle Lloyd
- WhatsApp Again on Google Play Retailer After a Transient Disappearance
- 'There was no blackmail': Volodymyr Zelensky weighs in on impeachment discussion
- Hundreds of Thomas Cook jobs still under threat despite rescue deal
- New CHARLIE'S ANGELS Trailer Promises Action, Comedy, and Day Drinking
- Payment firms back out in painful blow to Facebook’s cryptocurrency Libra
- 4 killed, 3 wounded in Brooklyn shooting
- Having a Dog Significantly Lowers Your Risk of Death, Scientists Say
- Climate change threatens two-thirds of America's birds with extinction
- China Accuses Apple of ‘Guiding Hong Kong Thugs’
- Samsung Galaxy Note 10 Lite rumored to launch in Europe