Sprint Nextel posted a wider quarterly loss on Wednesday as it took a hefty tax-related charge and valuable customers continued to flee, and its shares fell nearly 5 percent.

Sprint, the No. 3 US mobile service, posted a loss of $865 million, or 29 cents per share, compared with a year-earlier loss of $594 million, or 21 cents per share.

Excluding charges, the loss was 17 cents a share, in line with analysts' expectations, according to Thomson Reuters I/B/E/S.

Revenue fell 2 percent to $8.09 billion from $8.21 billion, but was ahead of Wall Street expectations of $8.05 billion.

Sprint said it had lost 578,000 postpaid customers who pay monthly bills and commit to long-term contracts, slightly better than the average expectation for 623,574 losses from six analysts contacted by Reuters.

The company's shares fell 4.6 percent to $3.90 in trading before the market opened.

(Reporting by Sinead Carew; Editing by Lisa Von Ahn)