World champion Marc Marquez won the opening MotoGP race of the season in Qatar after coming out on top in a thrilling battle with Valentino Rossi.