Sven-Goran Eriksson's side leap-frogged their Yorkshire counterparts after a display that will give Tykes boss Mark Robins plenty to think about.
Leicester were completely dominant in the first half and Vitor headed in Martyn Waghorn's free-kick after 17 minutes.
King then had an effort ruled out for offside, while Barnsley failed to muster a shot on target in the opening period.
Despite Leicester's continued control after half-time, the home side offered a greater threat and Nathan Doyle's piledriver walloped the underside of the crossbar.
But King secured the win in the 86th minute to stretch Barnsley's winless run to four games, leaving them two points above the drop zone.
Former England forward Darius Vassell made his Leicester debut at the expense of Matty Fryatt, who dropped to the bench alongside Jack Hobbs as Curtis Davies came into the heart of the Foxes defence.
Luke Potter replaced the injured Matt Hill at left-back for the home side, while Jacob Butterfield and Chris Wood were preferred to Doyle and Andy Gray.
Waghorn turned smartly inside from the left to leave Stephen Foster on his backside after seven minutes before drawing a smart save from Tykes goalkeeper Luke Steele.
In the 17th minute Barnsley midfielder Hugo Colace was lucky to escape with just a warning following a rash two-footed challenge on Kyle Naughton, but his side were to suffer the greater punishment.
Waghorn flighted in the free-kick 40 yards from goal and Portuguese defender Vitor was left unmarked to glance home.
King had the ball in the Barnsley net after 25 minutes from another well-worked free-kick, but his effort was chalked out for offside.
The hosts were floundering and boss Mark Robins made a double substitution with just half an hour gone.
Gray replaced Wood and Doyle came on for Paul Hayes, the latter switch drawing derision from the Oakwell faithful.
Barnsley continued to struggle with Leicester's set pieces and Davies' deflected shot from Waghorn's corner thumped into the outside of the post.
Four minutes before half-time the Tykes offered a belated threat when Jim O'Brien's cross was hacked to safety after sitting up invitingly on the edge of the Foxes' six yard box.
A sweeping move involving Yuki Abe and King almost gave Leicester a second on the stroke of the interval, but Steele was again on hand to thwart Waghorn.
With an hour gone, Leicester goalkeeper Chris Weale was finally called into action, holding O'Brien's low drive.
Weale could only watch in the 65th minute when Doyle's rasping 30 yard effort cannoned down off the crossbar and came within inches of bringing Barnsley level.
King sealed the points with four minutes remaining, sliding home from close range after Paul Gallagher broke down the Barnsley right.