* Indexes turn lower in afternoon trading
* Fall in crude oil weighs on energy shares
* Investors unnerved by shooting in Ottawa
* Indexes down: Dow 0.92 pct, S&P 500 0.73 pct, Nasdaq 0.83 pct
By Yasmeen Abutaleb
NEW YORK, Oct 22 (Reuters) - U.S. stocks erased earlier gains to close lower on Wednesday as a shooting at the Canadian parliament unnerved investors, Boeing and Biogen sold off following results, and energy stocks fell along with oil prices.
Indexes had traded in positive territory for much of the session, putting the S&P 500 on track for a fifth straight day of gains. Earnings initially drove the move higher, with technology and material shares up on the back of strong results.
Market benchmarks began drifting lower after the government reported a surprise increase in crude oil inventories. Energy shares were off 1.7 percent as crude oil fell, settling near $80 per barrel.
Canada’s capital was jolted by the fatal shooting of a soldier and an attack on the parliament building in which gunshots were fired outside a room where Prime Minister Stephen Harper was speaking. Toronto stocks fell 1.6 percent, also affected by oil’s slide.
“The situation out of Ottawa hastened the decline a bit, but I think it started with oil because people are very concerned about global growth,” said John Canally, chief economic and investment strategist for LPL Financial.
If the Ottawa shooting is related to domestic terrorism, Canally added, “it’ll put weight on the markets along with global growth.”
The Dow Jones industrial average fell 153.49 points, or 0.92 percent, to 16,461.32, the S&P 500 lost 14.17 points, or 0.73 percent, to 1,927.11 and the Nasdaq Composite dropped 36.63 points, or 0.83 percent, to 4,382.85.
Weaker oil and the Canada violence offset some encouraging economic news. U.S. consumer prices rose 0.1 percent in September as energy costs fell broadly, painting a weak inflation picture that could give the Federal Reserve room to keep interest rates low.
Among the day’s earnings movers, Biogen Idec fell 5.4 percent to $309.07 after sales of its multiple sclerosis drug, Tecfidera, fell short of lofty expectations.
Boeing Co lost 4.5 percent to $121.91, giving back most of the gains from the four prior sessions. Boeing reported higher-than-expected earnings and lifted its outlook, but analysts raised concern about the costs of the 787 Dreamliner.
On the upside, Yahoo Inc and Broadcom rallied a day after both tech companies reported better-than-expected revenue.
Broadcom shares climbed 5.5 percent to $39.37 while Yahoo was up 4.5 percent at $41.99. The two made up the S&P 500’s top percentage gainers.
After the close, revenue at Dow component AT&T fell short of analyst expectations and shares were down more than 2 percent.
Declining issues outnumbered advancers on the NYSE by 2,138 to 928, for a 2.30-to-1 ratio on the downside; on the Nasdaq, 1,988 issues fell and 701 advanced.
The benchmark S&P 500 index posted 44 new 52-week highs and 1 new low; the Nasdaq Composite recorded 54 new highs and 35 new lows.
About 7 billion shares changed hands on U.S. exchanges, below the 8.3 billion October average, according to BATS Global Markets. (Editing by Nick Zieminski)