Thousands panicked in the streets under heavy drizzle as firefighters and police were mobilised.
Diego Palacio, the social protection minister, said that there was no major damage, though there were power outages.
He said three people travelling in a car were killed in the quake.
Palacios said 10 homes and a church in the town of Puente Quetame sustained serious damage.
One government building in Bogota was evacuated after the quake sent a shower of bricks tumbling off one of its walls.