The army said that Eritrean military officials then issued an ultimatum for Djibouti to return all 30 Eritrean deserters on its soil or face armed action.
"At 6:40pm [1540 GMT], under the cover of darkness and prayer time, Eritrean troops opened fire on our soldiers," the statement said.
"In the face of this attack, our military struck back ... As this statement is published, the fighting continues."
The fighting is the first since Djibouti accused Eritrean forces of digging trenches on both sides of the border, infringing several hundred metres on to Djiboutian territory, an accusation Asmara has vehemently denied.
The claims began a tense stand-off which raised fears of an all-out military confrontation at the southern end of the Red Sea, one of the world's busiest shipping lanes.
Djibouti and Eritrea had twice previously clashed over the border area.
In April 1996 they almost went to war after a Djibouti official accused Eritrea of shelling the town of Ras Doumeira.
And in 1999, Eritrea accused Djibouti of siding with Asmara's rival Ethiopia, while Djibouti accused its neighbour of supporting Djiboutian rebels and having designs on the Ras Doumeira region.
According to international human rights organisations, thousands of young Eritreans attempt to leave their country every year.
Ethiopia recently reported that 1,300 Eritrean had defected and crossed the border in the last six months.
Djibouti is backed by France and the United States, both of which have big military bases in the country, while Eritrea is accused of backing anti-government fighters in Somalia and is involved in a long-running border standoff with Ethiopia.