The Omega Pharma - QuickStep rider sprinted to victory in Al Khor Corniche after avoiding a crash inside the final kilometre and choosing a position in the group which sheltered him from the wind.
His 10-second time bonus gives him the race leader's gold jersey ahead of Brent Bookwalter, who managed to finish at the back of the 30-man bunch sprint after being delayed by the crash.
Barry Markus (Vacansoleil-DCM) and Andrea Guardini (Astana) completed the podium.
Cavendish's lead is two seconds, with Bookwalter's BMC Racing team-mate Taylor Phinney third at eight seconds.
With 23km to go of the 160km run from the Camel Race Track, the early three-rider breakaway of Andriy Grivko (Astana), Gatis Smukulis (Katusha) and Pirmin Lang (IAM Cycling) still had a four-minute lead.
However the peloton reeled them in with eight kilometres remaining then several teams battled for control of the inevitable sprint.
Cavendish went wide after making contact with one rider - and having avoided the crash, opted to stay left due to his previous experience of the course.
Cavendish was again isolated from his lead-out man Matteo Trentin and the rest of the Omega Pharma - QuickStep team, but did not allow it to faze him as he sprinted to the win.
"We were a little bit nervous about the breakaway... but when we started riding, we started pulling them back really quickly. That was a really strong group out there," he said.
"Zdenek Stybar did a perfect job with 5km to go, and then Matteo Trentin put me in perfect position in the last roundabout at the 1.5-kilometre point.
"Niki Terpstra found me with a kilometre to go and moved me into the top 15 and I used the same tactics I did last year when I won on the same stage. The wind came from the right, everyone goes right, so I went left, and was shielded.
"So, I got the perfect position and acceleration in the sprint to get the win."
Thursday's fifth stage is a 154km run from Al Zubara Fort to Madinat Al Shamal.
"I think tomorrow is the main stage of the Tour of Qatar," Cavendish added. "We will see what happens, and then Friday is the last day, but we'll keep going for the stage wins and see what comes from that.
"I am really, really happy right now. Three wins already [this year] shows me that I made the right move to Omega Pharma - Quick-Step."