Honda rider Melandri timed 41 minutes, 44.139 seconds to beat world champion Valentino Rossi by 1.513 seconds into second place. United States' Nicky Hayden, on a Honda, was third in 41:51.012.
Rossi was attempting to equal Australian Mick Doohan's 1997 record of 12 wins in one season.
"Rossi was right behind me most of the time and what I did was to keep my concentration high," Melandri told a Turkish television station. "I'm happy to be on the podium after so much bad luck."
Earlier in the 250cc class, Australia's Casey Stoner won ahead of world champion Daniel Pedrosa of Spain.
Stoner, who fell off his bike at the Australian Grand Prix, led all the way to win in 39:28.243. Pedrosa clocked 39:28.336 and third-placed Hiroshi Aoyama timed 39:39.890.
Also, Mike Di Meglio of France won the 125cc class.
"I knew I had to take the race seriously right from the beginning to become successful," Di Meglio said. "It was very hard for me but also a lot of fun."
It was the 17-year-old rider's first Grand Prix victory. He finished in 39:50.377. Italy's Mattia Pasini came second and Japan's Tomoyoshi Koyama finished third.Reuse content