diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 6ea8af2..374141a 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2262,20 +2262,34 @@ function theme_table($variables) {
 }
 
 /**
- * Returns HTML for a sort icon.
+ * Prepares variables for tablesort indicator templates.
  *
- * @param $variables
+ * Default template: tablesort-indicator.html.twig.
+ *
+ * @param array $variables
  *   An associative array containing:
- *   - style: Set to either 'asc' or 'desc', this determines which icon to
- *     show.
+ *   - style: Set to either 'asc' or 'desc'. This determines which icon to show.
  */
-function theme_tablesort_indicator($variables) {
-  if ($variables['style'] == "asc") {
-    return theme('image', array('uri' => 'core/misc/arrow-asc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort ascending'), 'title' => t('sort ascending')));
+function template_preprocess_tablesort_indicator(&$variables) {
+  // Provide the image attributes for an ascending or descending image.
+  if ($variables['style'] == 'asc') {
+    $variables['uri'] = 'core/misc/arrow-asc.png';
+    $alt_title = t('sort ascending');
   }
   else {
-    return theme('image', array('uri' => 'core/misc/arrow-desc.png', 'width' => 13, 'height' => 13, 'alt' => t('sort descending'), 'title' => t('sort descending')));
-  }
+    $variables['uri'] = 'core/misc/arrow-desc.png';
+    $alt_title = t('sort descending');
+  }
+
+  // Add the image element.
+  $variables['image'] = array(
+    '#theme' => 'image',
+    '#uri' => $variables['uri'],
+    '#width' => 13,
+    '#height' => 13,
+    '#alt' => $alt_title,
+    '#title' => $alt_title,
+  );
 }
 
 /**
@@ -3184,6 +3198,7 @@ function drupal_common_theme() {
     ),
     'tablesort_indicator' => array(
       'variables' => array('style' => NULL),
+      'template' => 'tablesort-indicator',
     ),
     'mark' => array(
       'variables' => array('type' => MARK_NEW),
diff --git a/core/modules/system/templates/tablesort-indicator.html.twig b/core/modules/system/templates/tablesort-indicator.html.twig
new file mode 100644
index 0000000..f5e9c92
--- /dev/null
+++ b/core/modules/system/templates/tablesort-indicator.html.twig
@@ -0,0 +1,19 @@
+{#
+/**
+ * @file
+ * Default theme implementation for displaying a tablesort indicator.
+ *
+ * Available variables:
+ * - image: A renderable image element.
+ * - style: Either 'asc' or 'desc', indicating the sorting direction.
+ * - uri: URI to ascending or descending image.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_tablesort_indicator()
+ *
+ * @ingroup themeable
+ */
+#}
+{% spaceless %}
+  {{ image }}
+{% endspaceless %}
