“Do not lay up treasures for yourselves upon earth, where moth and rust destroy,” Jesus commanded (Matthew 6:19). Just before, He has been warning about practicing righteousness before men (6:1), in alms, prayer and fasting. The chapter ends with an exhortation to “seek first His kingdom and His righteousness” (v. 33). We store treasures in heaven by practicing righteousness in secret, before the Father who sees in secret. Treasures in heaven are reserved for those who seek God’s righteousness first. Treasures are stored up in heaven for those whose righteousness surpasses that of the scribes and Pharisees.
Jesus is alluding to the prophecy of Isaiah 51. There, Yahweh assures Zion that His righteousness is permanent (vv. 6, 8). And He sets this in contrast to the heavens and earth, which are like smoke and a threadbare garment (v. 6); He sets His righteousness in contrast to human enemies, who are like garments eaten by moths (v. 8). In Isaiah, the permanent “treasure” that doesn’t decay is the righteousness of Yahweh itself, the salvation that He brings near.