WASHINGTON—Defense Secretary Mark Esper fired Navy Secretary Richard Spencer on Sunday over the controversial case of a Navy SEAL that has created high-level friction between the president and the Pentagon.

Mr. Spencer was fired after Mr. Esper learned that the Navy secretary was negotiating a deal with the White House to find a solution to a military and political crisis that had pitted President Trump against top leaders of the Pentagon who believed the good order and discipline of the military was at stake.

“I...