The attack was underway in Qala-e-Naw, the capital of Badghis province, having started around 12:40 pm (08:10 GMT) when a group of men, some wearing suicide vests, entered the hotel.
Four Afghan security forces were killed Saturday when Taliban insurgents attacked a hotel, officials said, as violence continues across Afghanistan despite US-led efforts to end the war.
The assault took place in Qala-i-Naw, the capital of the western province of Badghis, when attackers struck a commercial area housing the hotel and several shops in the small city.
"We had intelligence reports that suicide bombers were planning to attack Qala-i-Naw," Badghis governor Abdul Ghafoor Malikzai told AFP.
"The attackers took over a building near the governor's office and police headquarters".
The defence ministry said three attackers were killed and two more arrested.
Four members of the Afghan security forces were killed and 20 people wounded, including civilians, the ministry said.
The incident comes less than a week after Taliban officials were sitting face-to-face with US negotiators in Doha in a bid to end Afghanistan's nearly 18-year-old war.
Both sides reported good progress in the talks, but daily carnage continues across Afghanistan and NATO on Saturday announced the death of a US service member who was killed in a Taliban-claimed attack.
The hotel assault started around 12:40 pm (08:10 GMT) when a group of men, some wearing suicide vests, stormed the area.
Aziz Bek, the head of the Badghis provincial council, told AFP that children had been evacuated from nearby schools, and that explosions could be heard in the city.
According to Abdul Latif Rostaee, the local director of public health, 18 were wounded, including six civilians.
Nasrat Rahimi, an interior ministry spokesman, earlier said a group of suicide bombers had entered a hotel and were shooting civilians.
The attackers first hit a police checkpoint and then entered the hotel, according to Haroon Amir, a witness.