However, it still failed to get a simple majority of 18 members in a close contest. Its supported candidates won 17 seats.
Its arch rival the Congress, which ruled the civic body for 26 years till the last elections in May 2012, got its 12 candidates elected.
Four Independents and one CPI-M candidate got elected after the counting held here.
Three independent candidates announced their support to the Congress. This means the Congress has the support of 15 candidates but it is short of the Bharatiya Janata Party (BJP)'s 17 winners.
"We are going to elect our Mayor and Deputy Mayor with the support of an Independent," a senior BJP leader told IANS.
Fourth independent winner Rajesh Kumar is a BJP rebel and he is likely to extend support to the party to help it get a simple majority.
The post of Mayor has been reserved for the woman-Scheduled Caste candidate, while the Deputy Mayor is unreserved. The term of both posts is two-and-a-half years.
In 2012, the CPI-M won the posts of Mayor and Deputy Mayor, who were elected directly unlike this time. It thus ruled the civic body with its three members in the then 25-seat House -- a majority of the councillors were from the BJP.
After merger of new areas, the number of councillors now stands at 34.
This election was the BJP's semi-final ahead of the assembly elections in the state, Member of Parliament Anurag Thakur said.
"The Shimla Municipal Corporation election was our semi-final that we have won. Now we are going to win the final (assembly polls), too," he told IANS over phone.
The stakes were high for six-time Chief Minister Virbhadra Singh in this elections as he was trying to prove he was still a mass leader and could lead the party in the forthcoming assembly polls also, while the BJP's two-time Chief Minister Prem Kumar Dhumal was fighting a "survival battle".
Dhumal was marginalised after the party's humiliating defeat in the December 2012 assembly polls.
At present, Dhumal is mainly challenged by his bete noire and Union Health Minister J.P. Nadda, who is trying to return to state politics ahead of the assembly elections.
Both Dhumal and Nadda sought votes for the BJP, generating a buzz among the voters.
Accepting the mandate of the electorate, CPI-M Mayor Sanjay Chauhan said: "We will continue to fight for demands and issues related to the locals."
Interestingly, the age-old issues of water shortage and spread of water-borne diseases were the prominent issues in the polls, besides shortage of parking lots, traffic jams and unscientific disposal of solid waste.