Chasing Bahrain's total of 172 runs, Afghan openers Karim Khan Sadiq and Nowraz Mangal slammed their more favoured rivals' pace attack around the field to notch up an opening partnership stand of 136 before Mangal was caught out for 60.
Sadiq, a 21-year-student from Kabul, slammed 12 fours and three sixes on his way to his first century in an international before being stumped for 109, leaving his team just four runs to get for the victory.
The trophy is the first international cricket tournament Afghanistan has played in for years. The sport, never big in Afghanistan, was banned for a time by the hardline Taliban militia, whose rule was ended in 2002 by US-led forces.
However, its popularity has risen in recent years, as millions of refugees who fled to Pakistan to escape decades of fighting have returned home.The Afghan team is hoping its results in Malaysia will help it win a place at the next cricket World Cup.
In other games, Qatar bowled out Singapore for 108 runs in the 31st over and needed just 19 overs to secure a seven-wicket victory and Kuwait used 29 overs and lost just two wickets to score the 164 runs needed to beat Maldives and join the United Arab Emirates in the quarter finals.
The champion and runner-up in the tournament, which ends June 22, will qualify for the ICC trophy in June next year in Ireland.