The S&P 500 had its best day since May on Tuesday which led to the index's largest weekly gain in four months.