The ruling brings to an end a six-week antitrust trial which heard regulators argue that the deal, worth $85m (£63.5m), would give AT&T undue leverage against rivals that rely on Time Warner content.
Judge Richard Leon of the US District Court for the District of Columbia said in his ruling that the government had "failed to meet its burden to establish that the proposed transaction is likely to lessen competition substantially".
The Justice Department had said the acquisition would hurt competition in the pay TV market, and assistant US attorney general Makan Delrahim said he was "disappointed" with the court's ruling.
He added: "We continue to believe that the pay TV market will be less competitive and less innovative as a result of the proposed merger between AT&T and Time Warner.
"We will closely review the court's opinion and consider next steps in light of our commitment to preserving competition for the benefit of American consumers."
David McAtee, AT&T general counsel, said: "We are pleased that, after conducting a full and fair trial on the merits, the court has categorically rejected the government's lawsuit to block our merger with Time Warner."
She (Munich: SOQ.MU - news) added: "Not only was the deal approved, but the judge did not impose any conditions on the merger, and went so far as to encourage Department of Justice not to file a stay pending appeal.
"We fully expect (AT&T) to close the acquisition on 18 June (the earliest possible date)."
The approval could encourage other companies pursuing similar tie-ups.
Among them is T-Mobile US, which is waiting for a government decision on their proposed merger with Sprint Corp .
Comcast, the largest US cable supplier, was waiting for the AT&T decision before making any large moves, according to sources.
Mary Ann Halford, senior adviser to OC&C Strategy Consultants, said: "Regardless of what happens on the appeal front, expect Comcast to put forth an all-cash bid in the next day or so at a premium to Disney.
"All I know is that this will be a blockbuster summer for media mergers."