Azerbaijan struck three times in 14 second-half minutes to recover from an early deficit against Kazakhstan in Baku and pick up their second win in Euro 2012 qualifying.
Visitors Kazakhstan took the lead through Sergey Ostapenko in the 20th minute and they held that advantage until eight minutes into the second half.
However, Azerbaijan, who held Belgium 1-1 on Friday, then turned the game on its head with goals from Rauf Aliyev, Mahir Shukurov (penalty) and Vagif Javadov to go 3-1 ahead.
Kazakhstan pulled a goal back with 13 minutes remaining through substitute Vitaly Yevstigneev but they could not force an equaliser in the closing minutes as Azerbaijan held on for the victory.
The win sees Azerbaijan move on to seven points in Group A, 17 behind already-qualified leaders Germany, while Kazakhstan remain bottom of the standings on three points.
Kazakhstan came into the match having suffered a heartbreaking 2-1 defeat at Turkey on Friday - Arda Turan's winning goal coming from a deflected free-kick six minutes into stoppage time - and they nearly suffered a nightmare start to today's game when Azerbaijan defender Shukurov hit the crossbar in just the second minute.
Javadov then had a shot parried by visiting custodian Alexandr Mokin before Kazakhstan started to get going.
Ostapenko brought a great save out of Kamran Agayev in the 11th minute and then nine minutes later the same player put Kazakhstan in front with a header from Alexandr Kirov's cross.
Mokin denied Javadov to keep his side in charge going into the break, but the hosts hit back after the interval with Aliyev heading in a 53rd-minute equaliser.
Javadov went close to making it 2-1 before Azerbaijan won a 61st-minute penalty when Aliyev was fouled by Mark Gurman, and Shukurov slotted home from the spot to put his side in front.
Six minutes later it was 3-1 when Javadov picked up a pass from Branimir Subasic and drilled home a low shot.
Kazakhstan gave themselves a chance of earning something from the game when Yevstigneev fired home from 25 yards less than 60 seconds after coming off the bench, but there would be no more goals as Azerbaijan claimed the spoils.