The present invention relates to an azole compound represented by the formula [I]wherein W is S or O; R is —COOR7, —X1-A1-COOR7 (R7 is H, alkyl) or tetrazolyl; R1, R2, R3 and R4 are H and the like; A is —(CH2)m—X— (X is —N(R8)—, —C(R9)(R10)—, —CO— or —CO—N(R8)—); B is aryl or aromatic heterocyclic group; R5 is H and the like; R6 is —(Y)s1-(A2)s-Z (Y is —O—, —S(O)t—, —N(R13)—, —N(R14)—CO—, —N(R14)—SO2—, —SO2—N(R14)— and the like, A2 is alkylene, and Z is cycloalkyl, aryl, aromatic heterocyclic group, indanyl, piperazinyl, a prodrug thereof or a pharmaceutically acceptable salt thereof. The compound [I] of the present invention has a protein tyrosine phosphatase 1B inhibitory activity, and is useful as a therapeutic agent for diabetes, a therapeutic drug for diabetic complications or a therapeutic drug for hyperlipidemia.