The Belgian grabbed his opportunity to ease clear in a three-way sprint for the gold with Jakob Fugslang, of Denmark, and Poland's Rafal Majka, as Tour de France champion Chris Froome missed out in his bid to make history on the opening day of action at the 2016 Olympics.
Van Avermaet won Belgium's first gold medal by a male athlete since swimmer Fred Deburghgraeve was victorious in the 100 meters breaststroke final at the Atlanta Games 20 years ago.
"When I saw the crash I was confused about how many riders were still up the road," the 31-year-old said. "I was working with Fugslang and we saw Majka. We knew it was possible. I knew I had to hang on.
"I am so happy for gold. Everyone said all week it was for everyone else."
The race looked to be playing into the hands of favorite Vincenzo Nibali, who broke clear in a group of three with Sergio Henao and Majka.
But, taking chances on a risky descent, both Nibali and Henao crashed, ending their races.
The chasing group passed them, but there was another faller in Britain's Geraint Thomas.
The ensuing carnage left Majka, winner of the King of the Mountains jersey at this year's Tour de France, clear out front but he was caught by van Avermaet and Fugslang with a kilometer to go, and the Pole had little to offer as the sprint kicked in to the line.
"Sometimes, it pays not to take risks," Fugslang said. "After the first climb I saw there was a bump on the road on the corner so I took it a little easier.
"I knew the medals were in play and I looked back, and no one was working so I attacked. I'm very happy to take a medal at these Olympics."
Majka, who was third at last year's Tour of Spain -- one of cycling's three grand events -- said he had such bad leg cramps that he could barely pedal.
"I don't know how I did not crash but somehow I made it through," the 26-year-old said. "When the others caught me, I knew that it was impossible to win. To come here and win bronze makes me so happy. I cannot believe it."
There was drama off the course of the 237-kilometer race when a controlled explosion was carried out on a suspect package near to the finish.
A Rio 2016 spokesman explained: "The security services found a suspicious package close to the cycle road race finishing line in Copacabana and as a precaution decided to perform a controlled explosion. There is no impact to the race."
Van Avermaet, who took six hours and 10 minutes to complete the punishing course, had not been tipped as one of the pre-race favorites despite a strong season in which he won a stage of the Tour de France and also wore the leader's yellow jersey.
But the former soccer player -- who didn't follow in the footsteps of his father and grandfather, both professional cyclists, until his late teens -- was comfortably the strongest of the riders under sun-kissed skies in Rio.
Froome had been bidding to become the first rider to win both the Tour de France and the men's Olympic road race -- let alone in the same year -- but the Brit missed an initial break which included teammates Thomas and Adam Yates.
The three-time Tour de France champ
tried to close the gap in the final 15 km of the race but it was too little, too late.
Froome, however, made it clear that his main target -- and better chance for winning gold -- would come in Wednesday's time trial.