An optical shape sensing system and method with at least two optical fibers (OSF1, OSF2) both comprising optical shape sensing elements. A processor (P) is arranged to register a coordinate system indicative of a position of one of the optical fibers (OSF1) in space, and to register a position (R2) of the other optical fiber (OSF2) in relation to this coordinate system. An optical console system (C, C1, C2) serves to interrogate the optical shape sensing elements in both optical fibers (OSF1, OSF2), and to accordingly determine a measure of a three-dimensional shape (I) of both optical fibers (OSF1, OSF2), based on the registered position (R2) of the second optical fiber (OSF2) in relation to the coordinate system. This provide the possibility of providing 3D optical shape sensing of the length of both optical fibers (OSF1, OSF2), thus allowing 3D shape reconstruction of e.g. long medical devices with lengths of several meters. More than two shape sensing optical fibers, e.g. incorporated in separate devices, can be registered in this manner in a hierarchical data structure, thus allowing shape sensing of very long instruments.