Leopard Racing’s Danny Kent won the Catalan GP in a thrilling finish that saw him beat rival Enea Bastianini by 0.035s.