Twelve of the dead were civilians and the rest government soldiers, witnesses told the AFP news agency on Sunday.
The attack on late Saturday also left five civilians injured, according to a doctor at a local hospital.
The Beni region is under siege from the Allied Defence Forces (ADF), a Ugandan rebel group that has operated in the region since 1995, which has been blamed for hundreds of civilian deaths over the past four years.
Foreign humanitarian workers have been stationed in Beni, in the North Kivu province near the border with Uganda, since early August to deal with a new Ebola outbreak in the region.
“The surprise attack happened in the streets of Beni city,” the doctor told AFP.
Heavy and light-calibre gunfire was heard for several hours until after midnight local time. It was not known whether the army counterattacked.
The rebels attacked areas near the centre of the trading settlement of several hundred thousand inhabitants.
The ADF group is responsible for the deaths of more than 1,500 people and 800 kidnappings since 2014, according to local civil society organisations.
North Kivu, one of the most populated areas of the DRC, is home to a number of armed groups that kill or abduct civilians.