NEW YORK ( TheStreet) -- Major U.S. stock averages reversed earlier losses to finish higher Wednesday as growing optimism about the jobs market offset a spike in oil prices prompted by political turmoil in Egypt and discouraging economic headlines in China. The S&P 500 rose 0.08% to close at 1,615.41, while the Dow Jones Industrial Average gained 0.38% to settle at 14,988.55. The Nasdaq advanced by 0.3% to 3,443.67. The gain in stock prices just before the holiday fits an historic pattern, Mark Newton, chief technical analyst at Greywolf Execution in New York, wrote in an investor ntoe. Over the last 30 years, stock indices embraced a slightly more positive tone ahead of holidays, followed by more negative action the day after a stretch of widely taken vacations. Newton added that while in the S&P has found meaningful resistance in each of the last four days from 1614 to 1620, it has also failed to make meaningful progress on the downside. Therefore he was expecting prices to yet again rise to challenge the 1614 to 1620 area before stalling and pulling back yet again. Stocks gained on a raft of encouraging U.S. labor market data ahead of the widely-watched U.S. government non-farm payrolls report due Friday. Private sector employment in the U.S. increased by a greater-than-expected 188,000 jobs in June from May after the month's job gains were revised downward to 134,000, according to the ADP National Employment Report. Economists on average were expecting June gains of 160,000. The Labor Department reported that weekly initial jobless claims for the week ending June 29 fell 5,000 to 343,000, which was better than expected. Economists were expecting them to come in at 345,000. The four-week moving average was 345,500, a decrease of 750 from the previous week's average of 346,250. Continuing claims for the week ending June 22 decreased by 54,000 to 2.933 million, also better than expected. Economists were predicting continuing claims of 2.953 million. Meanwhile, employment in the U.S. service sector strengthened in June even as the overall economy appears to have slowed, the Institute for Supply Management, a not-for-profit industry association, said on Wednesday. Robert Half International ( RHI) was one of the biggest losers in the S&P 500, falling 5.4% to $31.50 amid expectations that large companies will be less inclined to hire temporary workers after the Obama administration said Tuesday that it's postponing a healthcare mandate that would have fined employers with 50 or more workers at $2,000 or more per worker for failing to extend health benefits to full-time staffers. Staffing agencies tumbled Wednesday after the White House announced a healthcare mandate aimed at employers will be postponed. Robert Half International ( RHI), Manpower ( MAN), TrueBlue ( TBI) and On Assignment ( ASGN ) fell following the announcement. Robert Half led the slump losing 4.95% to trade at $31.56. Manpower stumbled 1.18% to $54.65 but was not expected to be dramatically affected by the decision due to its predominantly international revenue sources and larger company focus. August crude oil futures spiked by $1.67 to $101.27 a barrel Wednesday after Egyptian President Mohamed Morsi dismissed widening and violent protests calling for his departure and the country's foreign minister resigned amid these pressures. Fears about instability in Egypt rocked the markets because even though the country isn't a big producer, it still control major conduits for transporting the commodity. In Portugal, stocks sank and bond yields soared after two prominent ministers resigned, triggering anxiety about a possible collapse of the Portuguese government that could put its €78 billion bailout program in jeopardy. Adding to the global headaches was lackluster services sector data that deepened concerns about a slowing Chinese economy amid evidence of a slump in the manufacturing sector. The slowdown appears to be driven by the Chinese government's steadfastness about tightening policy to help guide China towards slower but more sustainable growth. U.S. stock markets closed at 1 p.m. on Wednesday. Bond markets were recommended to close at 2 p.m. On Thursday, U.S. markets will be closed for the Independence Day holiday in the U.S. Follow @atwtse Written by Andrea Tse in New York >To contact the writer of this article, click here: Andrea Tse.>.