Federer fights past Tsonga