This feature is a part of Custom Product Order. Click here to see all Custom Product Order features.
You can specify the fallback order type for the priority and attribute sorting. The fallback will be used when two or more products have the same value for the sorting field.
You can do it in Catalog Settings > General:
The default value is ‘Newest’, which sorts by the product publish date when the products have the same priority or attribute value.