With Christian Coleman absent in the men's 100m line-up as he contests his charge for whereabouts violations, Lyles and 37-year-old Gatlin were the heavy pre-race favourites on Thursday.
Roared on by 25,000 fans inside a packed Letzigrund, Lyles was a stride behind Gatlin after 60m and looked off the pace.
But Lyles is famous for his strong finish and, true to form, eventually powered past a tense-looking Gatlin in the final third to seal the title.
Second place went to China's Xie Zhenue in 10.04 seconds, while Jamaican Yohan Blake pipped Gatlin to third in 10.07 seconds.
Lyles will skip the 100m at next month's World Athletics Championships in Doha in order to concentrate on his favoured 200m.
He said afterwards, "I am taking one challenge at a time, race first and then perform. The 200m in Doha, that is definitely a sure thing.
"Today was like a World Championships final for me as I will not do the 100m in Doha."
"I will compete in Brussels next week. You will see me in the 200m there. Two years ago I was watching the others win Diamonds, oh my God. And this year I am trying to come away with two Diamond race wins. It is going to be something."
Personal best seals it for Miller-Uibo
Shaunae Miller-Uibo continued her two-year unbeaten streak over any distance to win the Women's 200m Diamond Trophy in a blistering personal best of 21.74 seconds.
Dutch world champion Dafne Schippers finished in fourth.
Olympic 400m champion Miller-Uibo confirmed afterwards that she would not run the 200m in Doha as she bids to claim her first world title.
She said, "This is my last run before the World Championships. My coach did a great job. I am in great shape. It is just a blessing. I am very excited.
"This is my second PB in Zurich. I guess it is a good track for me. At the World Championships I will run the 400m, not the 200m." - Shaunae Miller-Uibo
Warholm goes second on all-time list
World champion Karsten Warholm ran the second fastest 400m hurdles in history as he got the better of American Rai Benjamin.
The Norwegian broke his own European record with 46.92 seconds, just 0.14 outside Kevin Young's world record set at the 1992 Barcelona Olympics, with Benjamin just six-hundredths behind.
Warholm established a clear lead over his rivals in the early part of the race. However, a stutter on the penultimate hurdle almost gifted victory to Benjamin before Warholm pulled away once again to seal the trophy.
And the world record is definitely on the cards in Doha.
"It was crazy. I knew that I would do a good time but this race and with this new PB, it's just amazing and still the best will come." - Karsten Warholm after his 400m hurdles win
He added, "Now focusing for Doha and doing the same as usual, hard training. ln a way, I'd like to say goodbye and see you next season but it's the World Championships, the biggest thing this year.
"This race was so close it could have gone both ways. I push him and he pushes me, it's amazing."
Sydney McLaughlin stuns world again!
United States' Sydney McLaughlin became the youngest women's 400m hurdles Diamond League champion in history.
World record holder and 2019 world leader Dalilah Muhammad was the narrow pre-race favourite, but could only manage third as McLaughlin pulled clear to win in 52.85 seconds, just one-tenth outside her personal best.
Another American in Shamier Little took second.
The victory means that McLaughlin has not lost a Diamond League race over the hurdles all season.
One jump enough for Echevarria
Juan Miguel Echevarria sailed out to 8.65m in the first round of the long jump, the best leap in the world this year.
The young Cuban did not have another legal jump in the competition, but his new Diamond League record proved more than enough.
South Africa's Ruswahl Samaai was second with 8.20m ahead of Jamaica's Tajay Gayle on countback with reigning world champion Luvo Manyonga fourth just a centimetre further back.
But Echevarria looks the man to beat at the World Championships, and the recent Pan American Games champ thinks he can threaten Mike Powell's 1991 world record of 8.95m.
He said, "I feel so good, very happy and satisfied. It is a great performance. It showed great strength. I felt very good before the competition, I was prepared very well.
"We had very good conditions today. I liked the atmosphere here very much. In Doha, of course, I want to win the gold medal, like the others. Everything is possible, even a record."
Elsewhere, Shanieka Ricketts caused a shock in the women's triple jump.
With her final leap, the Jamaican recorded a personal best of 14.92m to overtake Olympic silver medallist Yulimar Rojas (14.74) and seal the Diamond Trophy. In the men's pole vault, United States' world champion Sam Kendricks leaped 5.93m to take first place ahead of Sweden's Armand Duplantis.