diff --git a/src/wp-includes/blocks.php b/src/wp-includes/blocks.php
index 1dc1e66230..84d36c626d 100644
--- a/src/wp-includes/blocks.php
+++ b/src/wp-includes/blocks.php
@@ -531,6 +531,13 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
 					$processed_styles[] = $result;
 				}
 			}
+
+			// we should put "wp-block-{$block_name}-theme" before styles from theme.json and any other styles,
+			// since these styles are default, so we should have opportunity to override it
+			if ( in_array( "wp-block-{$block_name}-theme", $processed_styles ) ) {
+				$processed_styles = array_diff( $processed_styles, array( "wp-block-{$block_name}-theme" ) );
+				array_unshift( $processed_styles, "wp-block-{$block_name}-theme" );
+			}
 			$settings[ $settings_field_name ] = $processed_styles;
 		}
 	}
