Wales were knocked out by Argentina at the quarter-final stage, with Halfpenny’s final appearance of the tournament coming in the pool-stage victory over Portugal.
His international retirement comes having won 101 caps, and with 801 points scored he is third in the all-time Welsh list behind Neil Jenkins and Stephen Jones.
In a statement, the 34-year-old said: “After having time to reflect after the Rugby World Cup campaign, it’s with a heavy heart that I’ve decided it’s time for me to step away from international rugby.
“The decision hasn’t been easy, but the time feels right for me now and I look forward to running out one last time against the Barbarians at home next week.
“It’s been a huge honour and a privilege to put on the Welsh jersey and represent my country over the last 15 years.”
Playing mainly as a full-back or winger, he made his Wales bow during the 2008 autumn series against South Africa aged 19, before going on to make four Test appearances for the British and Irish Lions during the 2013 and 2017 tours.
He was named player of the series in 2013 as the tourists claimed a 2-1 series victory in Australia.
His career began as a youngster in the academy at Ospreys before later joining Cardiff Blues in 2007, with whom he won the 2009 Anglo-Welsh Cup and 2010 European Challenge Cup.
He won the 2015 European Champions Cup after signing for Toulon before returning to Wales with Scarlets in 2017.
For Wales he has scored 15 tries and 81 conversions, as well as kicking 188 penalties en route to his final tally.
“There have been ups and downs, but I will look back on my international career with immense pride,” he said.
“There’s no better feeling running out to a full Principality Stadium wearing the Welsh jersey and singing the national anthem.
“I’m going to miss it, but I will be forever grateful for the opportunities I’ve had and to every single person who has helped me along the way.
“It’s been unbelievable to play with such special people over the years and I will cherish the friendships I’ve made.
“While I’ll be moving on from the international game, I’m excited about the next chapter as a player in this game which has given me so much, and look forward to sharing details on my club future soon.”
He is the fifth player to retire from Wales international duty this year after Alun Wyn Jones, Justin Tipuric and Rhys Webb, who confirmed they would step away in May, and Dan Biggar who retired after the team were knocked out of the World Cup.
Wales head coach Warren Gatland told wru.wales: “Leigh has had a fantastic career for Wales, firstly on the wing and then at 15 where he has been brilliant – probably the best defensive full-back in the world and a tremendous goal kicker.
“He’s had his fair share of injury challenges over the years but has never let that hold him back.
“If you are talking about role models in professional rugby, I don’t think you could find someone that works harder than Leigh in terms of how he prepares.
“The analysis, training and recovery he has done time and again has been really impressive, he is the ultimate professional.”