The surge in tablet usage helped boost AT&T’s wireless revenue for the latest quarter, but profits declined as costs surged, the company said Tuesday.

AT&T’s coffers were drained by smartphone sales, which it subsidizes in the hope of making money back over the life of two-year contracts. AT&T also made investments to increase its home broadband speeds.

AT&T Inc., the country’s largest telecommunications company, said it earned $3.8 billion, or 71 cents per share, in the April-to-June period, compared with $3.9 billion, or 66 cents share, a year ago.

Adjusted for a one-time gain of 4 cents for the sale of shares in Mexico’s America Movil, the latest earnings were 67 cents per share, 1 cent below the average analyst forecast as polled by FactSet.

AT&T’s revenue was $32.1 billion, up 1.6 percent from a year ago and well above the average analyst estimate at $31.8 billion.

The Dallas-based company added 550,000 wireless devices to its contract-based plans, which are the most lucrative.

That was the highest second-quarter figure in two years. However, all but 153,000 of the new devices were tablets, which carry lower monthly fees than phones.

AT&T shares fell 31 cents, or 0.9 percent, to $35.50 in extended trading, after the release of the report.