ZFS has a special class of device known as a SPARE.
Unlike normal devices, a SPARE belongs to the entire pool, not a single vdev.
If any vdev in the pool suffers a device failure, and a SPARE is attached to the pool and available, the SPARE will automatically attach itself to the degraded vdev.
IMPORTANT: SPARE devices do not permanently replace failed devices.
They're just placeholders, intended to minimize the window during which a vdev runs degraded.
Once the admin has replaced the failed device of the vdev, and the new permanent replacement device resilvers, the SPARE detaches itself from the vdev, and returns to pool-wide duty.