The Pacific coast of Nicaragua was settled as a Spanish colony from Panama in the early 16th century .