Warning: Make sure to download exact firmware for your model. You can discern your model from Settings > About phone > MIUI version (Eg: In MIUI version V13.0.6.0 SKHMIXM ‘MI’ represents your phone region, which is Global). You can also verify your Xiaomi phone at official site.
Tip: Some devices might have buggy USB support while in bootloader mode, if you see fastboot hanging with no output when using commands such as fastboot getvar ..., fastboot flash ... you may have to try a different USB port (preferably a USB Type-A 2.0 one) or use a USB hub.
  1. Extract firmware files from zip
    unzip -qq miui_*.zip firmware-update/*
    cd firmware-update
    
  2. Power off the device, and boot it into bootloader mode

  3. Run the following commands to flash firmware:
    fastboot flash abl abl.elf
    fastboot flash ablbak abl.elf
    fastboot flash aop aop.mbn
    fastboot flash aopbak aop.mbn
    fastboot flash bluetooth BTFM.bin
    fastboot flash cmnlib cmnlib.mbn
    fastboot flash cmnlibbak cmnlib.mbn
    fastboot flash cmnlib64 cmnlib64.mbn
    fastboot flash cmnlib64bak cmnlib64.mbn
    fastboot flash devcfg devcfg.mbn
    fastboot flash dsp dspso.bin
    fastboot flash hyp hyp.mbn
    fastboot flash hypbak hyp.mbn
    fastboot flash imagefv imagefv.elf
    fastboot flash imagefvbak imagefv.elf
    fastboot flash keymaster km4.mbn
    fastboot flash keymasterbak km4.mbn
    fastboot flash storsec storsec.mbn
    fastboot flash modem NON-HLOS.bin
    fastboot flash qupfw qupv3fw.elf
    fastboot flash qupfwbak qupv3fw.elf
    fastboot flash tz tz.mbn
    fastboot flash tzbak tz.mbn
    fastboot flash uefisecapp uefi_sec.mbn
    fastboot flash uefisecappbak uefi_sec.mbn
    fastboot flash xbl xbl.elf
    fastboot flash xblbak xbl.elf
    fastboot flash xbl_config xbl_config.elf
    fastboot flash xbl_configbak xbl_config.elf
    
  4. Reboot:
    fastboot reboot