Alvaro Bautista edged world champion Toprak Razgatlioglu on the line to win WorldSBK Race 1 after an epic battle in Estoril.