Jo-Wilfried Tsonga made a superb comeback to beat Roger Federer and end the third seed's hopes of a seventh Wimbledon title for another year.