The top seed claimed his ninth trophy at his home event as he overcame an inspired opponent who took the lead early in each set but was pegged back by the 20-time Grand Slam champion.
Federer will now aim to win number 100 by the end of the season.
“It's been a magical week for me, a dream run for me,” Federer said, prior to moving onto his traditional post-final pizza party with ballkids — of which he was one here two decades ago.
Federer won his 20th straight match at the tournament and has played in 12 straight Basel finals.
The 93rd-ranked Copil was competing in the biggest match of his life after emerging from qualifying.
But after knocking out sixth seed Marin Cilic and backing it up by defeating third seed Alexander Zverev in the last four, the Romanian found himself facing the king of the court in the final.
Victory was the 37-year-old Federer's 71st at the event.
He will be aiming to complete his century at the ATP Finals in London, which starts in a fortnight's time, but has yet to announce if he will travel to Paris for next week's final Masters event of the season, where he last
played in 2015.
Copil began the match with a break in the third game but lost it in the sixth as Federer levelled the opening set.
As the first set went to a tie-break, Federer needed three set points to take the lead as his opponent returned long.
Copil again showed his steel with an early break in the second set before Federer made another fightback with an overhead winner to break back in the seventh game.
The top seed grabbed a second break, with the Swiss serving out victory a game later on his first match point.
The title was the fourth this season for Federer, after the Australian Open, Rotterdam and Stuttgart.