The Aberdeen South MP Stephen Flynn beat Glasgow Central MP Alison Thewliss in a vote among SNP MPs at the party AGM Tuesday evening.
Mhairi Black was elected as the new Deputy Leader, replacing former deputy leader Kirsten Oswald.
Mr Flynn said: "It's an honour to be elected to lead the SNP's strong and talented team of MPs during such a crucial period for Scotland.
"Under my leadership, SNP MPs will be relentlessly focused on standing up for Scotland's interests and our democratic right to decide our future in an independence referendum.
"Families across Scotland are paying a devastating price under Westminster control, with Brexit, austerity cuts and the Tory cost of living crisis hammering household budgets.
"SNP MPs will work harder than ever to hold the Tory government to account - and make the case that independence is the essential route to safety, fairness and prosperity for Scotland.
"I would like to thank Alison Thewliss and Stuart McDonald who are both hugely talented MPs and will continue to play a key role in our movement.
"I would also like to pay tribute to Ian Blackford MP and Kirsten Oswald MP, who have been a fantastic leadership team and will be welcome sources of advice as we move forward together.
Reports last month suggested Mr Flynn could be angling for the job, before he stepped in to tamp down rumours of unrest within the party at Westminster but, within weeks, Mr Blackford had gone and the former Aberdeen City councillor announced his plans to seek the job.
In a tweet on Tuesday morning, Mr Blackford thanked his MP colleagues and SNP staff for their work under his tenure.
“Today is my last day in office for @theSNP as Westminster leader. Thank you to colleagues for the opportunity to serve both MPs and staff as well as all those who have supported and encouraged me,” he said.
“Good luck to my successor as look I forward to my next challenges.”
He will take on a post as the SNP’s ambassador to business after standing down.
Replying to the tweet, SNP leader Nicola Sturgeon expressed her thanks to Mr Blackford.