The Apple logo is seen on the window at an Apple Store on January 7, 2019 in Beijing, China.

Apple CEO Tim Cook said the company's prospects in China have significantly improved in just three months and it's in part because of the Trump administration's progress with the country in trade talks.

"I believe that the trade relationship — I don't mean the tariff, I mean the tone — is much better today than it was in the November-December time frame. That affects consumer confidence in a positive way," Cook told CNBC's Josh Lipton in an interview.

On the company's first-quarter earnings call Tuesday, Cook cited the improved trade talks, a China tax cut and iPhone trade-in and financing programs for a turnaround in the country.

"There's an improved trade dialogue between the U.S. and China, and from our point of view, this has affected consumer confidence on the ground there in a positive way. And so I think it's a set of all of these things, and we certainly feel a lot better than we did 90 days ago," the CEO said on the call.

In January, Apple shares dropped the most in six years after it slashed its revenue guidance, citing slowing iPhone sales in China. On Tuesday, the company said third-quarter revenue may be as high as $54.5 billion partly because of improved performance in China. That's higher than a $51.94 billion consensus analyst estimate for the quarter currently, according to Refinitiv.

The shares are up more than 5% in premarket trading Wednesday.

White House chief of staff Mick Mulvaney said on Tuesday that a trade agreement could be announced with Beijing within two weeks.

— With reporting by CNBC's Kif Leswing