Teofimo Lopez produced one of the best performances of his career to defeat Josh Taylor and claim his WBO world title at Madison Square Garden.