The outcome of the lawsuit marks an unusual victory for President-elect Donald J. Trump in his ongoing legal campaign against national news organizations.