Mrs Lam, 59, had the backing of the Chinese government in Beijing and was widely expected to win.
Hong Kong has a degree of autonomy from Beijing but protests have been growing over Chinese interference.
The chief executive is not chosen by public vote but by a 1,200-strong committee dominated by pro-Beijing electors.
Pro-democracy groups held protests outside the election venue, calling the process a sham.
Mrs Lam's main rival, former finance chief John Tsang, was the public's favourite, according to opinion polls.
The third candidate, and the most liberal, was retired judge Woo Kwok-hing.
Mrs Lam garnered 777 votes to Mr Tsang's 365. Mr Woo received 21.
Calls for fully free elections have failed, despite intense demonstrations, known as the "umbrella protests", in 2014.
Hong Kong's Election Committee picked Mrs Lam to succeed current leader CY Leung, who will step down in July. She was formerly his deputy.
Mrs Lam, a long-time civil servant, is nicknamed the nanny because of her background running numerous government projects.
During the 2014 protests, she took the unpopular stance of defending Beijing's concessions for political reform - allowing Hong Kong people to choose their leader but only from pre-approved candidates.
Pro-democracy activist Joshua Wong (centre) at protests on election day
Pro-democracy activist Joshua Wong, who was among those protesting and was a lead figure in the umbrella movement, has called the current electoral process "a selection rather than an election".
When the result was announced, he tweeted that Mrs Lam had been elected with "only 777 votes".
On Facebook, an online protest was launched called No Election in Hong Kong Now, which showed a video montage of regular citizens going about their business as the election took place to highlight how they were not entitled to participate.
Candidates Woo Kwok-hing, Carrie Lam and John Tsang pose as they greet election committee members on Sunday
Mr Leung has proved unpopular with large swathes of Hong Kong residents who consider him too tightly aligned to Beijing.
At the end of the 2016, he made the unexpected announcement that he would not run again, citing family reasons.
Outgoing leader CY Leung was elected in 2012 and, unusually, only served one term
Hong Kong is governed under the principle of "one country, two systems", under which China has agreed to give the region semi-autonomous status since its 1997 handover from Britain.
The Election Committee includes 70 members of the territory's legislature, the Legislative Council - half of whom are directly elected.
However, most of the Election Committee is chosen by business, professional or special interest groups.
Critics say entities that lean towards Beijing are given disproportionately large representation.
Last year, pro-democracy activists secured 325 seats on the committee - the highest number ever, but not enough seats to determine the next chief executive.
The 2014 "umbrella protests" were so-called after protesters used umbrellas to shield themselves from pepper spray fired by police