AT&T posted fourth-quarter results that bested Wall Street expectations on Wednesday.

The company said it saw strong wireless customer growth as well as fewer subscriber cancellations than the Street had projected. AT&T also gave strong guidance for fiscal 2018.

The stock rose more than 3 percent in after-hours trade as more than 5 million shares changed hands.

Here's how the company did compared with what analysts expected:

EPS: 78 cents vs. 65 cents expected according to Thomson Reuters

Revenue: $41.68 billion vs. $41.19 billion expected according to Thomson Reuters

U.S. wireless net adds: 2.7 million vs. 2.2 million expected according to StreetAccount

Mexico wireless net adds: 1.3 million vs. 1.1 million expected according to StreetAccount

Postpaid churn rate: 0.89% vs. 1.15% expected according to StreetAccount

AT&T said it added a total of 4.1 million wireless customers in the fourth quarter. The company said 2.7 million of those new customers were in the United States, more than the 2.2 million the Street had expected.

The company also said it saw its lowest-ever fourth-quarter subscriber cancellation rate. The postpaid churn rate was 0.89 percent for the quarter. The total was lower, therefore better, than Wall Street's expectation of 1.15 percent, according to StreetAccount.

For 2018, AT&T said it expects adjusted earnings of about $3.50 per share. Analysts had previously forecast that the company would report full-year earnings of $3.05 per share.

Randall Stephenson, chairman and CEO of AT&T, said in a statement he expects tax reform and "regulatory rationalization" to have a positive impact on both the economy and the company.

The company said it expects its 2018 effective tax rate to be about 23 percent. AT&T said that rate will likely lead to an additional $3 billion in cash. For the year, the company said it expects free cash flow of about $21 billion.

In December, AT&T said it will give $1,000 bonuses to more than 200,000 U.S. employees, citing the passage of tax reform. The company also said it plans to spend an additional $1 billion in the United States after the recent tax overhaul.

The new tax law slashes the corporate tax rate to 21 percent from the previous rate of 35 percent. AT&T said in its 2016 annual report that its effective tax rate was 32.7 percent.

The company could also stand to benefit from the FCC's recent repeal of net neutrality regulation. This new landscape allows AT&T more flexibility to control the pricing and speed of content for its internet customer. AT&T has said, however, it will not make big changes to the way internet services are delivered.

In a Wednesday earnings call, Stephenson said this ruling is a step in the right direction. He said, however, that Congress needs to create legislation that governs internet companies and protects consumers. Stephenson said that the industry needs the "long-term predictability" and clarity on issues like customer privacy and internet regulation.

But the mobile giant faces political headwinds amid increased scrutiny of mega-mergers. Late last year, the Justice Department challenged AT&T's pending merger with Time Warner. President Donald Trump has said the deal is "not good for the country" because it might lead to higher prices for consumers.

But Stephenson said in Wednesday's release that the company looks forward to presenting its case in court and finalizing the Time Warner deal.

Stephenson said during the earnings call that closing the acquisition is AT&T's top priority for 2018. He said the AT&T was surprised that the government moved to block the deal, calling the proposed acquisition a "classic vertical merger between two companies that don't even compete with one another."

"With 50 years of legal precedent, it's the type of business combination that the government has consistently approved with appropriate conditions," he said.

AT&T is slated to make its case for the merger on March 19.

— CNBC's Anita Balakrishnan and Ari Levy contributed to this report.