A 6.0 magnitude earthquake has devastated Afghanistan close to the Pakistani border, with more than 800 killed initially, local officials said, and many more feared missing.