Stocks snapped a six-day losing streak Friday, as the unofficial start of the quarterly corporate earnings season offered a crucial crutch for a limping market.

After a shaky week — including the steepest drop in eight months on Wednesday — the Standard & Poor’s 500-stock index rose 1.4 percent on Friday The tech-heavy Nasdaq Composite index climbed 2.3 percent, on strong gains from tech giants such as Apple, Amazon.com and Microsoft.

Friday’s rally repaired some of the damage done by a tumultuous week of trading. But the benchmark S. & P. 500 still lost 4 percent for the week.