Wimbledon champion Roger Federer beat world number one Rafael Nadal 6-4 6-3 in the Shanghai Masters final to capture his sixth title of the year.