In recent years, RNAs have been found to have diverse functions beyond being a messenger in gene transcription. The functions of non-coding RNAs are determined by their structures. Structure comparison/alignment of RNAs provides an effective mean to predict their functions. Despite many previous studies on RNA structure alignment, it is still a challenging problem to predict the function of RNA molecules based on their structure information. In this study, we developed a new RNA structure alignment method based on elastic shape analysis (ESA). ESA treats RNA structures as three dimensional curves and performs flexible alignment between two RNA molecules by bending and stretching one of the molecules to match the other. The amount of bending and stretching is quantified by a formal distance, geodesic distance. Based on ESA, a rigorous mathematical framework can be built for RNA structure comparison. Means and covariances can be computed and probability distributions can be constructed for a group of RNA structures. We further apply the method to predict functions of RNA molecules. Our method achieved very good performance tested on benchmark datasets