Alonso finished several seconds clear of his former McLaren teammate at the Circuit Gilles Villeneuve.
As Alonso was forced to back off due to a brake-related issue, Hamilton closed in with a series of fastest laps.
The Spaniard soon picked up the pace again to score his first Montreal podium since 2013.
Reflecting on his race, Alonso said: “Close, the closest I think. It was our most competitive race of the year in terms of pace.
“We were matching the Red Bull most of the race and sometimes we lost a little bit of pace. At one point I thought the race was over, and second place was good, but I saw Lewis coming so fast. The last driver you want to see in your mirrors is Lewis Hamilton when he comes fast.
“I had a little bit more pace in hand and in the end he was never in the DRS gap. It was good to finish second but they were like 70 laps of qualifying today.”
At one point in the race, Alonso was the fastest driver on track, reducing Max Verstappen’s lead to under four seconds.
However, his charge was curtailed by the fact he had to lift and coast into corners.
Alonso admitted the prospect of backing off was discussed beforehand.
“I don’t think there was much in it to be honest. It’s a circuit where you can give up a bit on entry to get better exits. We discussed also before the race that a lift and coast was maybe needed. I was ready for that and I don’t think it had an impact on the race result.”