Roger Federer defeated fellow Swiss Stan Wawrinka in straight sets to reach the US Open final, where he will play Novak Djokovic.