The South American favourites needed to be patient and had to wait until the 83rd minutes for the all-important winner as Casemiro volleyed home from 10 yards, his shot hitting Akanji on the way in.
The victory confirmed Brazil’s place in the last 16 while Switzerland’s knockout hopes will now rest on their final Group G game on Friday.
Both sides were looking to build on victories from their opening fixtures in their campaign with Brazil having downed Serbia 2-0 and the Swiss edging our Cameroon 1-0.
Akanji was his usual calm, composed presence at the heart of the Swiss defence as Murat Yakin’s side sought to repel the South Americans.
Vinicius Junior and Raphinha both went close for Brazil in the first half only to find Swiss keeper Yann Sommer in fine form.
It wasn’t all one-way traffic however with Switzerland putting a Brazil side missing the injured Neymar under pressure at times after the break.
Brazil did have the ball in the net thanks a cool finish from the dangerous Vinicius Junior on 67 minutes.
However, the effort was disallowed following a VAR check with Tottenham striker Richarlison deemed offside in the initial build-up.
But with time running out, Brazil’s patience and persistence was finally rewarded.
Vinicius Jnr found Rodrygo from the left wing, who laid it off to Manchester United midfielder Casemiro who volleyed home.
Akanji then made two superb stops to deny Brazil a second in injury time in what proved a tight, hard-fought affair.
Akanji’s City colleague Ederson was an unused substitute for Brazil.
The result leaves Brazil on top of Group G with six points, Switzerland are second on three points with Cameroon and Serbia both having one apiece.
The group games conclude on Friday with Brazil tackling Cameroon and the Swiss pitted against Serbia.