diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js
index 43d4ad7c0e9f63..3a65cb4669dbc1 100644
--- a/lib/internal/fs/promises.js
+++ b/lib/internal/fs/promises.js
@@ -1160,7 +1160,7 @@ async function realpath(path, options) {
   options = getOptions(options);
   path = getValidatedPath(path);
   return await PromisePrototypeThen(
-    binding.realpath(path, options.encoding, kUsePromises),
+    binding.realpath(pathModule.toNamespacedPath(path), options.encoding, kUsePromises),
     undefined,
     handleErrorFromBinding,
   );
diff --git a/test/parallel/test-fs-long-path.js b/test/parallel/test-fs-long-path.js
index f3a8ea7a9ebf9e..11724a88dc4c29 100644
--- a/test/parallel/test-fs-long-path.js
+++ b/test/parallel/test-fs-long-path.js
@@ -46,4 +46,7 @@ fs.writeFile(fullPath, 'ok', common.mustSucceed(() => {
 
   // Tests https://github.com/nodejs/node/issues/39721
   fs.realpath.native(fullPath, common.mustSucceed());
+
+  // Tests https://github.com/nodejs/node/issues/51031
+  fs.promises.realpath(fullPath).then(common.mustCall(), common.mustNotCall());
 }));