* Amazon crosses $900 bln in market cap for first time
* UAL rise on beat-and-raise report, boost airlines
* CSX gains on profit beat; other railroads rise
* Lower oil prices weigh on energy companies
* Indexes: Dow up 0.10 pct, S&P flat, Nasdaq down 0.22 pct (Updates to open)
July 18 (Reuters) - The S&P 500 hovered at five-month highs on Wednesday, with gains in financial and industrial stocks due to strong earnings from marquee companies offsetting losses in the technology and energy sectors.
On a day when highly valued tech stocks were one of the biggest drags on the benchmark index, Amazon.com Inc became the second company after Apple to top $900 billion in market value before retreating.
Morgan Stanley rose 3.3 percent after its profit topped analysts' estimates on gains in fixed income and equities trading businesses.
Berkshire Hathaway's Class B shares rose 3.9 percent and were the biggest boost to the S&P 500 after the company eliminated a restriction on its ability to buy back its stocks.
The S&P financial sector rose 0.81 percent, matching the increase in the industrial sector.
Industrials were boosted by earnings beat from United Airlines and railroad CSX Corp, which helped ease concerns about the impact of the trade dispute on domestic hauls.
UAL also raised its 2018 profit forecast, sending its shares up 6.9 percent and boosting other airline stocks. CSX rose 5.1 percent and pushed shares of other railroad operators higher.
Larry Kudlow, head of the White House Economic Council and President Donald Trump's top economic adviser, said China's President Xi Jinping was "holding up" a deal to resolve a "significant trade dispute" between the two countries.
"The overall driver in the markets today is earnings, as we haven't heard anything new on trade," said Art Hogan, chief market strategist at B. Riley FBR in New York.
Eight of the 11 main S&P 500 sectors were lower, led by the energy sector's 1.23 percent drop, as crude prices fell on rising U.S. inventories.
At 10:12 a.m. EDT the Dow Jones Industrial Average was up 26.23 points, or 0.10 percent, at 25,146.12, the S&P 500 was down 1.04 points, or 0.04 percent, at 2,808.51 and the Nasdaq Composite was down 17.46 points, or 0.22 percent, at 7,837.66.
Weighing on the markets was weakness in technology stocks , with Apple and Microsoft the biggest drags on the S&P and the Nasdaq. The tech sector was down 0.31 percent and weighed the most on the market.
Declining issues outnumbered advancers for a 1.40-to-1 ratio on the NYSE and for a 1.46-to-1 ratio on the Nasdaq.
The S&P index recorded 21 new 52-week highs and no new lows, while the Nasdaq recorded 51 new highs and 25 new lows. (Reporting by Amy Caren Daniel in Bengaluru; Editing by Arun Koyyur)