"The collapse showed a glimpse of the heart of Genoa", he said.
He encouraged the mourners to show solidarity in building "new bridges to walk together" to rise above the tragedy.
An imam has blessed the coffins of two Muslim faithful at the end of a Catholic Mass for those killed in the Italian bridge tragedy.
A state of emergency has since been declared, as rescuers continue to look for survivors, while Saturday has been declared a national day of mourning, on which funerals of numerous victims are set to be held.
Afterward, Mattarella called the funeral, which took place on a day of national mourning, "a moment of grief, shared grief, by all of Italy".
The death toll in Italy's bridge collapse has gone up to 41 after three more bodies were found under the rubble by rescue workers, Italian media reported.
A few hours earlier, the bodies of an Italian couple and their 9-year-old daughter were found in their smashed vehicle under a big block of concrete, part of tons of material that crashed 150 feet into a dry riverbed and nearby areas when the heavily trafficked major highway span gave way.
Earlier, Deputy Transport Minister Edoardo said Autostrade, owned by Italy's Benetton family, could lose its concession as it had failed to ensure the viaduct's safety. The man's mother had refused to leave a tent set up a few hundred yards away from the rubble until his body was found.
Italian RAI state radio said it is believed he is the last missing person after a German man called officials to say he was not involved in the disaster. Ten people are still in the hospital, with nine of them recovering from severe injuries.
Doctors had described him as the most severely injured of the survivors, while authorities said several other bridge survivors are still hospitalised.
Follow the action from Trent Bridge
The biggest headache for Virat Kohli to sort out the top order woes and he will have to juggle a bit with his batting options. But it still needed a robust effort from two of the side's senior batsmen to restore the dressing room's confidence.
Before the state funeral began, President Sergio Mattarella, head bowed, paused in silence before the coffins, then spoke briefly with each group of families.
The cause of the collapse is still unclear.
Infrastructure across Italy will be double-checked in the aftermath of the disaster, the government has promised.
One survivor, whose auto plunged from the bridge to the bottom along with falling sections of highway, told the Associated Press how as a trained firefighter he immediately understood that the structure had collapsed when the road dropped out from under him.
Eighteen coffins were lined up in a hall of the Fiera del Mare exhibition centre.
A section of the bridge gave way on Tuesday in busy lunchtime traffic, plunging dozens of vehicles 50m below and engulfing Autostrade per l'Italia into a political fire storm.
Some coffins have already been placed in a large hall for the state funeral, and family members visited them on Friday.
Giovanni Castellucci, CEO of Autostrade per l'Italia, the company that manages Italian highways and bridges, told reporters it has a plan to demolish what's left of the largely concrete 51-year-old Morandi Bridge and build a "less imposing" steel span.
He said the process will take about eight months to complete.
"Apologies and responsibilities are things that are connected".