The announcement was made by King Carl XVI Gustaf just after 5pm on Wednesday at a cabinet meeting ahead of the Swedish parliament's final sitting before its summer break.
He added that prince had also been given the title Duke of Ångermanland, in northern Sweden.
While Niklas is a common Swedish name, the royals have picked the more unusual spelling Nicolas for the baby.
Nicolas Paul Gustaf was born 49 centimetres long and weighing 3080 grams.
"I am tired but very happy,” Madeleine's British-born American businessman husband Chris O'Neill told reporters in his first public appearance on Tuesday morning, when he was seen leaving Danderyd Hospital north of Stockholm just before 8am.
Referring to his eldest daughter, he later told reporters: “Leonore thought he was a doll,” adding that the siblings' first meeting had gone well.
One of the prince's middle names -- Paul -- honours Chris O'Neill's father Paul Cesario O'Neill, who died in 2004, while Gustaf is a name commonly taken by male members of the Swedish royal family.
Awaiting the formal announcement, The Local
got people tweeting the #choosechuck and #backbjörn hashtags after suggesting the new baby could be named Chuck to honour O'Neill's American heritage or Björn after the member of Sweden's most famous pop group ever, Abba.
According to Sweden's Aftonbladet, Eugen was the most popular name being bet on at Swedish bookmakers ahead of the announcement with Oscar, Wilhelm and Paul also popular.
Nicolas Paul Gustaf is sixth in line to the Swedish throne.