Motive determines it: works done for self are burned, while works done for God's glory and others' benefit endure as gold, silver, and precious stones.
Watch the Teaching: If God Already Knows Everything, Why Do We Pray?