The lift from shares of Google, Amazon and Microsoft were enough to drive the S.&P. 500 back into positive territory for the year.