Tunisia's Oussama Mellouli won the gold medal in one hour 45 minutes 18.5 seconds. The 22-year-old Weinberger followed in 1:45:30.2 and Petar Stoychev of Bulgaria was third in 1:45:34.1
"To know I'm going to the Olympics is just unexplainable," said Weinberger. "I don't think it has sunk in just yet."
Weinberger overcame a rough start to the race. Within the first 200 metres, he ripped off a bothersome cap and lost his goggles, forcing him to stop and fall into last place.
"There are a lot of ups and downs in marathon swimming so we train for that," said Weinberger. "I knew I would just have to chip away and rely a lot on my training. My race plan didn't really work out but I knew what I had to do to catch the field."
His split times indicate a strong comeback. He was in order 49th, 23rd, 15th, eighth and fifth at the splits in the six-lap race.
In the past year Weinberger has won key marathon events, including the Olympic test event last summer at Hyde Park and the Pan American Games last fall.
During the World Cup season, Weinberger collected a silver in Argentina, and bronze in Brazil.
Xavier Desharnais of Sherbrooke, Que., was 20th.
The top-nine finishers — with a limit of one per country — earned an Olympic nomination.
Canada has two marathon swimming nominees for the Olympics.
On Saturday, Toronto's Zsofia Balazs earned her spot with a sixth place finish in the women's 10 kilometre.