Zechariah 12 opens with a heading: a revelation of Yahweh's word concerning Israel. It names the speaker as Yahweh, who stretches out the heavens and lays the foundation of the earth, and forms the spirit of man within him. The God who made the universe is the God who will act for his people.
The chapter describes a day when nations gather against Jerusalem, but God makes the city a burdensome stone for all who try to lift it. The focus is God's protection: in that day Yahweh will defend the inhabitants of Jerusalem. He who is feeble among them will be like David, and David's house will be like God. The chieftains of Judah recognize where their strength comes from: the inhabitants of Jerusalem are my strength in Yahweh of Armies their God.
Then the chapter turns from victory to repentance. God says, I will pour on David's house and on the inhabitants of Jerusalem the spirit of grace and of supplication. They will look to me whom they have pierced; and they shall mourn for him as one mourns for his only son. The mourning spreads through every family, each one apart. God's grace leads not to pride but to deep sorrow and prayer. In the New Testament, John 19:37 quotes this verse at the cross, and Revelation 1:7 says every eye will see him, including those who pierced him.