Complex sentence: France formally allied with the Americans and entered the war in 1778, and Spain joined the war in 1779 as an ally of France but not directly of the United States.
Split into simpler sentences: France formally allied with the Americans and entered the war in 1778. Spain later joined as an ally of France but not directly of the United States.