An earthquake with a preliminary magnitude of 5.9 struck northern Colombia on Tuesday night, the US Geological Survey said.