diff --git a/lib/manager/nuget/__fixtures__/with-whitespaces/NuGet.config b/lib/manager/nuget/__fixtures__/with-whitespaces/NuGet.config
new file mode 100644
index 0000000000000000000000000000000000000000..cc8abe128eb32c663d6f9c9c95d95b36c8ed6dfe
--- /dev/null
+++ b/lib/manager/nuget/__fixtures__/with-whitespaces/NuGet.config
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <packageSources>
+    <clear />
+    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> 
+    <add key="My Package Source" value="https://my.myget.org/F/my/auth/guid/api/v3/index.json" />
+  </packageSources>
+</configuration>
diff --git a/lib/manager/nuget/__fixtures__/with-whitespaces/with-whitespaces.csproj b/lib/manager/nuget/__fixtures__/with-whitespaces/with-whitespaces.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..872e2011797349d93f898e9881483b95a26f86fe
--- /dev/null
+++ b/lib/manager/nuget/__fixtures__/with-whitespaces/with-whitespaces.csproj
@@ -0,0 +1,12 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <TargetFramework>netcoreapp3.1</TargetFramework>
+        <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
+    </ItemGroup>
+
+</Project>
diff --git a/lib/manager/nuget/artifacts.ts b/lib/manager/nuget/artifacts.ts
index a3b6fdeaab8d33b736ae776e806a8ab497b5a86a..3ff382af5367054b0700127ef22574d9769c63ab 100644
--- a/lib/manager/nuget/artifacts.ts
+++ b/lib/manager/nuget/artifacts.ts
@@ -1,4 +1,5 @@
 import { join } from 'path';
+import { quote } from 'shlex';
 import { GlobalConfig } from '../../config/global';
 import { TEMPORARY_ERROR } from '../../constants/error-messages';
 import { id, parseRegistryUrl } from '../../datasource/nuget';
@@ -45,7 +46,7 @@ async function addSourceCmds(
     let addSourceCmd = `dotnet nuget add source ${registryInfo.feedUrl} --configfile ${nugetConfigFile}`;
     if (registry.name) {
       // Add name for registry, if known.
-      addSourceCmd += ` --name ${registry.name}`;
+      addSourceCmd += ` --name ${quote(registry.name)}`;
     }
     if (username && password) {
       // Add registry credentials from host rules, if configured.
diff --git a/lib/manager/nuget/extract.spec.ts b/lib/manager/nuget/extract.spec.ts
index e12e01825c8af806ff7b40d02a32fbea6346f945..d12fc9b4e69adb77cc855b680d3ed4108d175619 100644
--- a/lib/manager/nuget/extract.spec.ts
+++ b/lib/manager/nuget/extract.spec.ts
@@ -132,6 +132,26 @@ describe('manager/nuget/extract', () => {
         ],
       });
     });
+
+    it('handles NuGet.config with whitespaces in package source keys', async () => {
+      const packageFile = 'with-whitespaces/with-whitespaces.csproj';
+      const contents = loadFixture(packageFile);
+      expect(await extractPackageFile(contents, packageFile, config)).toEqual({
+        deps: [
+          {
+            currentValue: '12.0.3',
+            datasource: 'nuget',
+            depName: 'Newtonsoft.Json',
+            depType: 'nuget',
+            registryUrls: [
+              'https://api.nuget.org/v3/index.json#protocolVersion=3',
+              'https://my.myget.org/F/my/auth/guid/api/v3/index.json',
+            ],
+          },
+        ],
+      });
+    });
+
     it('ignores local feed in NuGet.config', async () => {
       const packageFile =
         'with-local-feed-in-config-file/with-local-feed-in-config-file.csproj';