diff --git a/core/lib/Drupal/Core/Cron.php b/core/lib/Drupal/Core/Cron.php
index a544ca8..cc6bdba 100644
--- a/core/lib/Drupal/Core/Cron.php
+++ b/core/lib/Drupal/Core/Cron.php
@@ -101,6 +101,12 @@ public function __construct(ModuleHandlerInterface $module_handler, LockBackendI
    * {@inheritdoc}
    */
   public function run() {
+    // Prevent cron from running in maintenance mode if the service is invoked
+    // from anywhere.
+    if ($this->state->get('system.maintenance_mode', FALSE)) {
+      return FALSE;
+    }
+
     // Allow execution to continue even if the request gets cancelled.
     @ignore_user_abort(TRUE);
 
diff --git a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
index 702fdb2..0c465ac 100644
--- a/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
+++ b/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
@@ -242,13 +242,17 @@ protected function runUpdates() {
       'required' => TRUE,
     ]]]);
 
+    $pre_update_maintenance_mode = \Drupal::state()->get('system.maintenance_mode', FALSE);
+    \Drupal::state()->set('system.maintenance_mode', TRUE);
     $this->drupalGet($this->updateUrl);
     $this->clickLink(t('Continue'));
 
     $this->doSelectionTest();
     // Run the update hooks.
     $this->clickLink(t('Apply pending updates'));
+    $this->assertResponse(200);
 
+    \Drupal::state()->set('system.maintenance_mode', $pre_update_maintenance_mode);
     // Ensure there are no failed updates.
     if ($this->checkFailedUpdates) {
       $this->assertNoRaw('<strong>' . t('Failed:') . '</strong>');
